{"matchId":"56605600","creationMatch":"match","runtimeMatch":"match","verifiedAt":"2026-10-22T02:05:14Z","creationBytecode":{"onchainBytecode":"0x61020060405230608052348015610014575f5ffd5b50604051615f5e380380615f5e833981016040819052610033916104ea565b6001600160a01b03821661005a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0380881660a05286811660c052848116610100528281166101205281166101c08190521561015f57806001600160a01b0316876001600160a01b0316036100bb576040516367472e0f60e11b815260040160405180910390fd5b5f816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061011c9190610581565b905060128160ff161115610143576040516312d5a04560e01b815260040160405180910390fd5b61014e8160126105bc565b61015990600a6106be565b6101e052505b6001600160a01b038616158015906102345750856001600160a01b031663c885f95a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101ae573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101d291906106cc565b6001600160a01b0316638acfcaf76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061023191906106e7565b46145b1580156101405261044b576001600160a01b0385166102665760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831661028d5760405163d92e233d60e01b815260040160405180910390fd5b846001600160a01b031663fe6d81246040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ed91906106cc565b6001600160a01b03166382bfefc86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610328573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061034c91906106cc565b6001600160a01b031660e0816001600160a01b031681525050846001600160a01b0316631f87f3336040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103a1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c591906106cc565b6001600160a01b031661016081905260408051631057fdf960e31b815290516382bfefc8916004808201926020929091908290030181865afa15801561040d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061043191906106cc565b6001600160a01b039081166101805283166101a0526104c7565b6001600160a01b038616156104c757856001600160a01b0316633416919b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610496573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104ba91906106cc565b6001600160a01b031660e0525b505050505050506106fe565b6001600160a01b03811681146104e7575f5ffd5b50565b5f5f5f5f5f5f5f60e0888a031215610500575f5ffd5b875161050b816104d3565b602089015190975061051c816104d3565b604089015190965061052d816104d3565b606089015190955061053e816104d3565b608089015190945061054f816104d3565b60a0890151909350610560816104d3565b60c0890151909250610571816104d3565b8091505092959891949750929550565b5f60208284031215610591575f5ffd5b815160ff811681146105a1575f5ffd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b60ff82811682821603908111156105d5576105d56105a8565b92915050565b6001815b6001841115610616578085048111156105fa576105fa6105a8565b600184161561060857908102905b60019390931c9280026105df565b935093915050565b5f8261062c575060016105d5565b8161063857505f6105d5565b816001811461064e576002811461065857610674565b60019150506105d5565b60ff841115610669576106696105a8565b50506001821b6105d5565b5060208310610133831016604e8410600b8410161715610697575081810a6105d5565b6106a35f1984846105db565b805f19048211156106b6576106b66105a8565b029392505050565b5f6105a160ff84168361061e565b5f602082840312156106dc575f5ffd5b81516105a1816104d3565b5f602082840312156106f7575f5ffd5b5051919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e05161569c6108c25f395f818161023201528181610e6b0152818161110001526111a701525f81816102a601528181610dc501528181610e1801528181610f1e0152818161109a015261113e01525f818161042e01526125f901525f8181610192015261250101525f81816102d9015281816124df01526125d701525f81816103b8015281816123420152818161243b015261253301525f818161046101528181611aa701528181611b2301528181611b9f01528181611c1b01528181611c9701528181611d1301528181611d8f01528181611e9001528181611fb3015281816120d601528181612152015261402401525f818161031f015281816121ce0152818161220001526122ad01525f818161027301528181611f91015281816120b4015261240901525f818161035201528181611dc101528181611e6e01528181611ec201528181611f6f01528181611fe501528181612092015281816122df01526123e701525f818160f70152818161038501528181611847015281816118f40152818161192601526119d301525f610b14015261569c5ff3fe6080604052600436106100e7575f3560e01c80637286c0a611610087578063d737d0c711610057578063d737d0c7146103ea578063ee1e230d1461041d578063f1cefec214610450578063fa461e3314610483575f5ffd5b80637286c0a61461030e578063972ce39614610341578063ad5c464814610374578063c001b76d146103a7575f5ffd5b806327165e2e116100c257806327165e2e1461026257806327d973b41461029557806332218a6c146102c85780633593564c146102fb575f5ffd5b80630479d64414610181578063150b7a02146101d157806322c740c114610221575f5ffd5b3661017d57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480159061014457507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c155b1561017b576040517f38bbd57600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f5ffd5b34801561018c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101dc575f5ffd5b506101f06101eb3660046149f2565b6104a2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c8565b34801561022c575f5ffd5b506102547f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101c8565b34801561026d575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a0575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d3575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b61017b610309366004614a60565b6106a9565b348015610319575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561034c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561037f575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156103b2575f5ffd5b506103da7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016101c8565b3480156103f5575f5ffd5b507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6101b4565b348015610428575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561045b575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561048e575f5ffd5b5061017b61049d366004614b03565b610815565b5f7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5f036104fd576040517fb5cf512a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5c7f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075c7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315c6001600160a01b0382166105a3576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038416146105e5576040517f1b532e9b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316886001600160a01b031614610630576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808714610669576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610671610a0c565b61067b3388610a8c565b507f150b7a020000000000000000000000000000000000000000000000000000000098975050505050505050565b6106b1610b09565b8382146106ea576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80421115610724576040517f203d82d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c1561079557333014610784576040517f6f5ffb7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61079085858585610b6b565b610809565b61079d610d66565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6107cb86868686610b6b565b6107d481610e8f565b6040516001600160a01b038216907f99e0904407d080d7df635d4f68017fa5eb20cfbb1e51c1a6259a218eae490bc1905f90a2505b5050505050565b905090565b61081d610b09565b7f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b0381163314610888576040517fabae80280000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b6108b27f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5f61137d565b5f8086139085138082036108f2576040517f49133b7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f826108fe5786610900565b875b90505f61090f86880188614d0e565b6040810151909150156109ae575f81604001805161092c90614e0a565b908181525090506109a1825f0151828151811061094b5761094b614e1f565b60200260200101518360200151838151811061096957610969614e1f565b60200260200101518561097b90614e4c565b338660405160200161098d9190614ebe565b604051602081830303815290604052611384565b5050505050505050610a06565b8060a001518211156109ec576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a00816060015182608001513385611552565b50505050505b50505050565b610a367f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5f61137d565b610a607f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075f61137d565b610a8a7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315f61137d565b565b5f610a978383611607565b9050805c15610aa557505050565b610ab081600161137d565b610ada7fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461166a565b610b047f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68361166a565b505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a8a576040517f8de9ad8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b825f5b81811015610d5e575f5f610bc9888885818110610b8d57610b8d614e1f565b9050013560f81c60f81b60f881901c607f16917f8000000000000000000000000000000000000000000000000000000000000000909116151590565b9150915080610c0457610bff82878786818110610be857610be8614e1f565b9050602002810190610bfa9190614f80565b611695565b610d54565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f884901b1660208201525f9060210160408051808303601f19018152600180845283830190925292505f9190816020015b6060815260200190600190039081610c5a579050509050878786818110610c8357610c83614e1f565b9050602002810190610c959190614f80565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250855186945090925015159050610cdc57610cdc614e1f565b60209081029190910101526040517f3593564c0000000000000000000000000000000000000000000000000000000081523090633593564c90610d2890859085905f199060040161500f565b5f604051808303815f87803b158015610d3f575f5ffd5b505af1925050508015610d50575060015b5050505b5050600101610b6e565b505050505050565b610d907f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d3361137d565b610dc37ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc58610dbe344761508d565b61137d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610a8a57610e457fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b27f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661137d565b610a8a7fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55617f000000000000000000000000000000000000000000000000000000000000000061137d565b5f610eb97fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd7735612656565b90505f5b81811015611003575f610ef07fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77358361265e565b9050610f1c7f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac782612673565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610f5b5750610ffb565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610fb8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdc91906150a0565b90508015610ff857610ff86001600160a01b0383168683612682565b50505b600101610ebd565b5061102d7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77356126d0565b5f6110366126dd565b90505f81156111d2575f5f856001600160a01b0316846040515f6040518083038185875af1925050503d805f8114611089576040519150601f19603f3d011682016040523d82523d5f602084013e61108e565b606091505b5091509150816111cf577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110fa57806040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b5f6111257f0000000000000000000000000000000000000000000000000000000000000000866150f6565b90505f8111801561116757506111656001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016888361274c565b155b156111a057816040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b6111cb60017f000000000000000000000000000000000000000000000000000000000000000061508d565b9350505b50505b806111db6126dd565b1115611213576040517f60c79e6900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61121c612763565b90505f5b81811015611324575f5f6112338361278d565b9150915061124182826127ec565b61124c57505061131c565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa9250505080156112c6575060408051601f3d908101601f191682019092526112c39181019061512e565b60015b1561130f57306001600160a01b0382160361130d576040517fd30e2b5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6113198282612807565b50505b600101611220565b5061132d61281a565b6113577ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585f61137d565b6108097f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5f5b80825d5050565b5f807f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b038116156113f4576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161087f565b6114277f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c896001600160a01b031661137d565b5f876114475773fffd8963efd1fc6a506488495d951d5263988d2561144e565b6401000276a45b6040517f128acb080000000000000000000000000000000000000000000000000000000081529091506001600160a01b038a169063128acb089061149e9089908c908c9087908c90600401615149565b60408051808303815f875af11580156114b9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114dd9190615192565b90945092507f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c15611546576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038a16600482015260240161087f565b50509550959350505050565b306001600160a01b038416036115725761156d84838361286c565b610a06565b6001600160a01b03831615806115bb57507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6001600160a01b0316836001600160a01b031614155b156115f2576040517f8eb5b89100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a066001600160a01b03851684848461290b565b604080516001600160a01b03841660208201529081018290527f8d303e8787b8b7c55b97cfe6cd669d7c86fa2957639fd61f37cd6dbc0fbcb63b60608201525f906080016040516020818303038152906040528051906020012090505b92915050565b5f61167483612656565b90505f611681848361295a565b905082815d610a0684610dbe8460016151b4565b826116a457610b048282612991565b600183036116b657610b048282612ce6565b600883036116c857610b048282612f29565b600983036116da57610b048282613569565b602183036116ec57610b048282613a7f565b600e83036116fe57610b048282613b3d565b60048303611789576040517f7382819800000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063738281989061175890859085906004016151f0565b5f6040518083038186803b15801561176e575f5ffd5b505af4158015611780573d5f5f3e3d5ffd5b50505050505050565b600583036117e3576040517f066cfad100000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063066cfad19061175890859085906004016151f0565b600f830361183d576040517fb1fe6fd100000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063b1fe6fd19061175890859085906004016151f0565b600b830361191c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166118a8576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f1fe8554200000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e1390631fe855429061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b600c83036119fb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611987576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f704c288a00000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063704c288a9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60348303611a53576040517e15460000000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e1390621546009061175890859085906004016151f0565b60248303611acf576040517fa4dbb3b10000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf34774054939063a4dbb3b19061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60258303611b4b576040517f09257a650000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf3477405493906309257a659061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60268303611bc7576040517f1a8ba09b0000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf347740549390631a8ba09b9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60278303611c43576040517fcc08716e0000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf34774054939063cc08716e9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60288303611cbf576040517f9baecc480000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf347740549390639baecc489061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60228303611d3b576040517f3bba8523000000000000000000000000000000000000000000000000000000008152730028a78d20d2d5d230cc4b2a23b90793a95cb69190633bba85239061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60238303611db7576040517fc58512f6000000000000000000000000000000000000000000000000000000008152730028a78d20d2d5d230cc4b2a23b90793a95cb6919063c58512f69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60298303611eb8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611e22576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f47af55b300000000000000000000000000000000000000000000000000000000815273e463e88df582c0b7a6d530f85c2c6954fb4f3c00906347af55b39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b602a8303611fdb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611f23576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fcea3f4ff00000000000000000000000000000000000000000000000000000000815273e463e88df582c0b7a6d530f85c2c6954fb4f3c009063cea3f4ff9061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602d83036120fe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612046576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f84acbbb3000000000000000000000000000000000000000000000000000000008152738eda4655fd8e6bb3aff3d3f36610b1efec24aa22906384acbbb39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602f830361217a576040517fdce507bc000000000000000000000000000000000000000000000000000000008152738eda4655fd8e6bb3aff3d3f36610b1efec24aa229063dce507bc9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601283036121f6576040517f852495f70000000000000000000000000000000000000000000000000000000081527347a3b182d028d503a6e6cd2bd1b4c11960d121139063852495f79061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601383036122d5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612261576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7707d3b60000000000000000000000000000000000000000000000000000000081527347a3b182d028d503a6e6cd2bd1b4c11960d1211390637707d3b69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60148303612431577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612340576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b7f00000000000000000000000000000000000000000000000000000000000000001561239b576040517f1ce431f30000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7b232fa10000000000000000000000000000000000000000000000000000000081527347a3b182d028d503a6e6cd2bd1b4c11960d1211390637b232fa19061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60308303612529577f0000000000000000000000000000000000000000000000000000000000000000612493576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f8b08833000000000000000000000000000000000000000000000000000000000815273ff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e90638b0883309061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60328303612621577f000000000000000000000000000000000000000000000000000000000000000061258b576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fef0607f600000000000000000000000000000000000000000000000000000000815273ff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e9063ef0607f69061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b6040517fd76a1e9e0000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b5f815c611664565b5f5f61266a848461295a565b5c949350505050565b61267e82825f613c78565b5050565b61268f8383836001613c8a565b610b04576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b6126da815f61137d565b50565b5f477ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585c8082101561273b576040517f53dad58300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612745818361508d565b9250505090565b5f6127598484845f613c8a565b90505b9392505050565b5f6108107fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e2612656565b5f5f6127b97fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461265e565b91506127e57f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68461265e565b9050915091565b5f6127fe6127fa8484611607565b5c90565b15159392505050565b61267e6128148383611607565b5f61137d565b6128437fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e26126d0565b610a8a7f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b66126d0565b7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316836001600160a01b03161480156128b557506128b283613d05565b81115b156128f7576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b610b046001600160a01b0384168383612682565b612919848484846001613df3565b610a06576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b5f818360405160200161296f91815260200190565b604051602081830303815290604052805190602001205f1c61275c91906151b4565b5f61299e828401846152a0565b9050806060015180156129c757505f60408201515160018111156129c4576129c46153ae565b14155b156129fe576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612a18835f0151846020015160018660a00151613e79565b8451516060860151929450909250905f90612a4557612a40856020015186604001515f6144ef565b612a4f565b8460400151602001515b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612aab576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8560600151612abb5730612ade565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b604080515f80825260208201818152828401909352929350915b85811015612c8b575f86612b0d8360016151b4565b14612b185730612b1e565b8960a001515b9050306001600160a01b03821603612b5c57612b5c89612b3f8460016151b4565b81518110612b4f57612b4f614e1f565b6020026020010151614676565b5f6040518060c001604052808681526020018581526020015f81526020018b8581518110612b8c57612b8c614e1f565b60200260200101516001600160a01b03168152602001876001600160a01b031681526020018881525090505f5f612c068d5f01518681518110612bd157612bd1614e1f565b60200260200101518c8781518110612beb57612beb614e1f565b60200260200101518b878760405160200161098d9190614ebe565b915091505f8b8681518110612c1d57612c1d614e1f565b6020026020010151612c2f5782612c31565b815b90505f811315612c6d576040517f62f708cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c7681614e4c565b99503098505050505050806001019050612af8565b508760800151841015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810185905260440161087f565b50505050505050505050565b5f612cf3828401846153db565b90505f5f612d0f835f0151846020015160018660a00151613e79565b915091505f6001845f015151612d25919061508d565b9050306001600160a01b03168460a001516001600160a01b031603612d5357612d5383612b3f8360016151b4565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84604001511115612db1576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8460600151612dc15730612de4565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508460600151612dfc57612dfc8560200151614676565b5f6040518060c00160405280875f0151815260200185815260200184815260200187602001516001600160a01b03168152602001836001600160a01b03168152602001876080015181525090505f5f612ea9885f01518681518110612e6357612e63614e1f565b6020026020010151878781518110612e7d57612e7d614e1f565b60200260200101518a60400151612e9390614e4c565b8b60a001518760405160200161098d9190614ebe565b915091505f868681518110612ec057612ec0614e1f565b6020026020010151612ed25782612ed4565b815b9050886040015181612ee590614e4c565b14612f1c576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b5f612f36828401846152a0565b905080606001518015612f5f57505f6040820151516001811115612f5c57612f5c6153ae565b14155b15612f96576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612faf835f015184602001515f8660a00151613e79565b915091505f835f01515190505f838281518110612fce57612fce614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b031603612ffe57612ffe81614676565b5f85606001516130205761301b866020015187604001515f6144ef565b61302a565b8560400151602001515b9050613086866020015187606001516130435730613066565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b885180515f9061307857613078614e1f565b602002602001015184611552565b5f805b84811015613483575f5f5f8a5f015184815181106130a9576130a9614e1f565b60200260200101516001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156130ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131109190615498565b50915091505f89858151811061312857613128614e1f565b602002602001015161313a578161313c565b825b90505f8b868151811061315157613151614e1f565b60200260200101516001600160a01b03166370a082318e5f0151888151811061317c5761317c614e1f565b60200260200101516040518263ffffffff1660e01b81526004016131af91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156131ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ee91906150a0565b905081811015613256578c5180518790811061320c5761320c614e1f565b60200260200101516040517f6cda144000000000000000000000000000000000000000000000000000000000815260040161087f91906001600160a01b0391909116815260200190565b613260828261508d565b9450505050505f895f0151838151811061327c5761327c614e1f565b60200260200101516001600160a01b0316630ea099c1838b86815181106132a5576132a5614e1f565b60200260200101516040518363ffffffff1660e01b81526004016132dc9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa1580156132f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331b91906150a0565b90505f8761332a8560016151b4565b101561335c578a5161333d8560016151b4565b8151811061334d5761334d614e1f565b60200260200101519050613434565b8a608001518210156133aa5760808b01516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810183905260440161087f565b5060a08a01516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528816906370a0823190602401602060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061343191906150a0565b94505b6134758b5f0151858151811061344c5761344c614e1f565b60200260200101518a868151811061346657613466614e1f565b602002602001015184846146c1565b505050806001019050613089565b5060a08701516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908616906370a0823190602401602060405180830381865afa1580156134eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061350f91906150a0565b613519919061508d565b90508760800151811015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810182905260440161087f565b5f613576828401846153db565b90505f5f613591835f015184602001515f8660a00151613e79565b915091505f835f01515190505f8382815181106135b0576135b0614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b0316036135e0576135e081614676565b5f6135ec8360016151b4565b67ffffffffffffffff81111561360457613604614b52565b60405190808252806020026020018201604052801561362d578160200160208202803683370190505b509050856040015181848151811061364757613647614e1f565b6020908102919091010152825b801561376d5761366381614e0a565b9050865f0151818151811061367a5761367a614e1f565b60200260200101516001600160a01b031663b95d88f88383600161369e91906151b4565b815181106136ae576136ae614e1f565b6020026020010151888460016136c491906151b4565b815181106136d4576136d4614e1f565b60200260200101516040518363ffffffff1660e01b815260040161370b9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa158015613726573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061374a91906150a0565b82828151811061375c5761375c614e1f565b602002602001018181525050613654565b508560800151815f8151811061378557613785614e1f565b602002602001015111156137c5576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f86606001516137d557306137f8565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508660600151613810576138108760200151614676565b613855876020015182895f01515f8151811061382e5761382e614e1f565b6020026020010151855f8151811061384857613848614e1f565b6020026020010151611552565b5f805b85811015613998575f8661386d8360016151b4565b101561389f5789516138808360016151b4565b8151811061389057613890614e1f565b60200260200101519050613929565b5060a08901516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528716906370a0823190602401602060405180830381865afa158015613902573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061392691906150a0565b92505b61398f8a5f0151838151811061394157613941614e1f565b602002602001015189848151811061395b5761395b614e1f565b60200260200101518785600161397191906151b4565b8151811061398157613981614e1f565b6020026020010151846146c1565b50600101613858565b5060a08801516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908716906370a0823190602401602060405180830381865afa158015613a00573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a2491906150a0565b613a2e919061508d565b90508860400151811015612f1c578860400151816040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260040161087f929190918252602082015260400190565b5f80613a8d8385018561552f565b6040517f3593564c00000000000000000000000000000000000000000000000000000000815291935091503090633593564c90613ad390859085905f199060040161500f565b5f604051808303815f87803b158015613aea575f5ffd5b505af1925050508015613afb575060015b610a06573d808015613b28576040519150601f19603f3d011682016040523d82523d5f602084013e613b2d565b606091505b50613b378161475f565b50610a06565b5f8080613b4c8486018661560d565b919450925090505f6001600160a01b038416613b91576001600160a01b0383163014613b8257826001600160a01b031631613b8a565b613b8a6126dd565b9050613c33565b6001600160a01b0383163014613c27576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa158015613bfe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c2291906150a0565b613c30565b613c3084613d05565b90505b81811015610d5e576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b815f52826020528060405f205d505050565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316613cf9578383151615613ced573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b5f7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316826001600160a01b031603613d74577fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55615c613d6a6126dd565b61166491906150f6565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015613dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061166491906150a0565b6040517f23b872dd000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f51148316613e68578383151615613e5c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b6060806001600160a01b038316613ebc576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85515f819003613ef8576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613f038160016151b4565b67ffffffffffffffff811115613f1b57613f1b614b52565b604051908082528060200260200182016040528015613f44578160200160208202803683370190505b5092508067ffffffffffffffff811115613f6057613f60614b52565b604051908082528060200260200182016040528015613f89578160200160208202803683370190505b50915085835f81518110613f9f57613f9f614e1f565b60200260200101906001600160a01b031690816001600160a01b0316815250505f5b818110156144e4575f888281518110613fdc57613fdc614e1f565b60209081029190910101516040517fe3152b4c0000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301529192505f917f0000000000000000000000000000000000000000000000000000000000000000169063e3152b4c90602401602060405180830381865afa158015614069573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061408d919061512e565b90506001600160a01b0381166140da576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b6040517f5b16ebb70000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152821690635b16ebb790602401602060405180830381865afa158015614137573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061415b919061564b565b61419c576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b5f826001600160a01b031663648da8596040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141fd91906150a0565b9050881561426e577f434c0000000000000000000000000000000000000000000000000000000000008114614269576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b614300565b7f56325f564f4c4154494c4500000000000000000000000000000000000000000081141580156142be57507f56325f535441424c4500000000000000000000000000000000000000000000008114155b15614300576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b5f5f846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561433e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614362919061512e565b856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143c2919061512e565b915091505f826001600160a01b03168a88815181106143e3576143e3614e1f565b60200260200101516001600160a01b0316149050801580156144305750816001600160a01b03168a888151811061441c5761441c614e1f565b60200260200101516001600160a01b031614155b15614467576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8089888151811061447a5761447a614e1f565b91151560209283029190910190910152806144955782614497565b815b8a6144a38960016151b4565b815181106144b3576144b3614e1f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050505050806001019050613fc1565b505094509492505050565b5f8115614665575f8351600181111561450a5761450a6153ae565b14614541576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038616906370a0823190602401602060405180830381865afa15801561459e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145c291906150a0565b90506145d2858560200151614767565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa15801561462f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061465391906150a0565b61465d919061508d565b91505061275c565b61466f84846147a6565b905061275c845b6126da7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77357f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac7836147ba565b5f5f846146cf57835f6146d2565b5f845b6040517f022c0d9f00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526001600160a01b038681166044830152608060648301525f60848301529294509092509087169063022c0d9f9060a4015f604051808303815f87803b15801561474d575f5ffd5b505af1158015612cda573d5f5f3e3d5ffd5b805160208201fd5b61477082614676565b61267e6001600160a01b0383167f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c308461290b565b5f61275c836147b485613d05565b846147e8565b5f8181526020839052604090205c156147d257505050565b6147de82826001613c78565b610b04838261166a565b5f80825160018111156147fd576147fd6153ae565b0361485657828260200151111561484b576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b50602081015161275c565b620f42408260200151111561489f5781602001516040517f966987d500000000000000000000000000000000000000000000000000000000815260040161087f91815260200190565b612759838360200151620f42405f5f5f6148b9868661495c565b91509150815f036148dd578381816148d3576148d36150c9565b049250505061275c565b8184116148f4576148f46003851502601118614978565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b6001600160a01b03811681146126da575f5ffd5b80356149a881614989565b919050565b5f5f83601f8401126149bd575f5ffd5b50813567ffffffffffffffff8111156149d4575f5ffd5b6020830191508360208285010111156149eb575f5ffd5b9250929050565b5f5f5f5f5f60808688031215614a06575f5ffd5b8535614a1181614989565b94506020860135614a2181614989565b935060408601359250606086013567ffffffffffffffff811115614a43575f5ffd5b614a4f888289016149ad565b969995985093965092949392505050565b5f5f5f5f5f60608688031215614a74575f5ffd5b853567ffffffffffffffff811115614a8a575f5ffd5b614a96888289016149ad565b909650945050602086013567ffffffffffffffff811115614ab5575f5ffd5b8601601f81018813614ac5575f5ffd5b803567ffffffffffffffff811115614adb575f5ffd5b8860208260051b8401011115614aef575f5ffd5b959894975060200195604001359392505050565b5f5f5f5f60608587031215614b16575f5ffd5b8435935060208501359250604085013567ffffffffffffffff811115614b3a575f5ffd5b614b46878288016149ad565b95989497509550505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715614ba257614ba2614b52565b60405290565b6040805190810167ffffffffffffffff81118282101715614ba257614ba2614b52565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bf457614bf4614b52565b604052919050565b5f67ffffffffffffffff821115614c1557614c15614b52565b5060051b60200190565b5f82601f830112614c2e575f5ffd5b8135614c41614c3c82614bfc565b614bcb565b8082825260208201915060208360051b860101925085831115614c62575f5ffd5b602085015b83811015614c88578035614c7a81614989565b835260209283019201614c67565b5095945050505050565b80151581146126da575f5ffd5b80356149a881614c92565b5f82601f830112614cb9575f5ffd5b8135614cc7614c3c82614bfc565b8082825260208201915060208360051b860101925085831115614ce8575f5ffd5b602085015b83811015614c88578035614d0081614c92565b835260209283019201614ced565b5f60208284031215614d1e575f5ffd5b813567ffffffffffffffff811115614d34575f5ffd5b820160c08185031215614d45575f5ffd5b614d4d614b7f565b813567ffffffffffffffff811115614d63575f5ffd5b614d6f86828501614c1f565b825250602082013567ffffffffffffffff811115614d8b575f5ffd5b614d9786828501614caa565b60208301525060408281013590820152614db36060830161499d565b6060820152614dc46080830161499d565b608082015260a091820135918101919091529392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f81614e1857614e18614ddd565b505f190190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f7f80000000000000000000000000000000000000000000000000000000000000008203614e7c57614e7c614ddd565b505f0390565b5f8151808452602084019350602083015f5b82811015614eb45781511515865260209586019590910190600101614e94565b5093949350505050565b6020808252825160c083830152805160e084018190525f92919091019082906101008501905b80831015614f10576001600160a01b038451168252602082019150602084019350600183019250614ee4565b5060208601519250601f19858203016040860152614f2e8184614e82565b92505050604084015160608401526060840151614f5660808501826001600160a01b03169052565b5060808401516001600160a01b03811660a08501525060a084015160c08401528091505092915050565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614fb3575f5ffd5b83018035915067ffffffffffffffff821115614fcd575f5ffd5b6020019150368190038213156149eb575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b606081525f6150216060830186614fe1565b828103602084015280855180835260208301915060208160051b840101602088015f5b8381101561507657601f19868403018552615060838351614fe1565b6020958601959093509190910190600101615044565b505080945050505050826040830152949350505050565b8181038181111561166457611664614ddd565b5f602082840312156150b0575f5ffd5b5051919050565b602081525f61275c6020830184614fe1565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82615129577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561513e575f5ffd5b815161275c81614989565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a060808201525f61518760a0830184614fe1565b979650505050505050565b5f5f604083850312156151a3575f5ffd5b505080516020909101519092909150565b8082018082111561166457611664614ddd565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f6127596020830184866151c7565b604081525f6152166040830185876151c7565b90506001600160a01b0383166020830152949350505050565b606081525f6152426060830186886151c7565b6001600160a01b039485166020840152929093166040909101529392505050565b608081525f6152766080830187896151c7565b6001600160a01b039586166020840152938516604083015250921660609092019190915292915050565b5f602082840312156152b0575f5ffd5b813567ffffffffffffffff8111156152c6575f5ffd5b820180840360e08112156152d8575f5ffd5b6152e0614b7f565b823567ffffffffffffffff8111156152f6575f5ffd5b61530287828601614c1f565b825250602083013561531381614989565b602082015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc083011215615347575f5ffd5b61534f614ba8565b9150604083013560028110615362575f5ffd5b8252606083013560208301526040810182905261538160808401614c9f565b606082015260a08301356080820181905291506153a060c0840161499d565b60a082015295945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f602082840312156153eb575f5ffd5b813567ffffffffffffffff811115615401575f5ffd5b820160c08185031215615412575f5ffd5b61541a614b7f565b813567ffffffffffffffff811115615430575f5ffd5b61543c86828501614c1f565b825250602082013561544d81614989565b602082015260408281013590820152606082013561546a81614c92565b60608201526080828101359082015260a0909101359061548982614989565b60a08101919091529392505050565b5f5f5f606084860312156154aa575f5ffd5b5050815160208301516040909301519094929350919050565b5f82601f8301126154d2575f5ffd5b813567ffffffffffffffff8111156154ec576154ec614b52565b6154ff6020601f19601f84011601614bcb565b818152846020838601011115615513575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215615540575f5ffd5b823567ffffffffffffffff811115615556575f5ffd5b615562858286016154c3565b925050602083013567ffffffffffffffff81111561557e575f5ffd5b8301601f8101851361558e575f5ffd5b803561559c614c3c82614bfc565b8082825260208201915060208360051b8501019250878311156155bd575f5ffd5b602084015b838110156155fe57803567ffffffffffffffff8111156155e0575f5ffd5b6155ef8a6020838901016154c3565b845250602092830192016155c2565b50809450505050509250929050565b5f5f5f6060848603121561561f575f5ffd5b833561562a81614989565b9250602084013561563a81614989565b929592945050506040919091013590565b5f6020828403121561565b575f5ffd5b815161275c81614c9256fea2646970667358221220b8a30eb1e02532ff610779827384314975eaddd07be359e3ffd777d2332607ad64736f6c63430008240033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000382409fad8503fbcdbb27a4211551fa03e8840780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d61f078592ced81449a7405d837ff1b963b830ea0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c546122390000000000000000000000000000000000000000000000000000000000000000","recompiledBytecode":"0x61020060405230608052348015610014575f5ffd5b50604051615f5e380380615f5e833981016040819052610033916104ea565b6001600160a01b03821661005a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0380881660a05286811660c052848116610100528281166101205281166101c08190521561015f57806001600160a01b0316876001600160a01b0316036100bb576040516367472e0f60e11b815260040160405180910390fd5b5f816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061011c9190610581565b905060128160ff161115610143576040516312d5a04560e01b815260040160405180910390fd5b61014e8160126105bc565b61015990600a6106be565b6101e052505b6001600160a01b038616158015906102345750856001600160a01b031663c885f95a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101ae573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101d291906106cc565b6001600160a01b0316638acfcaf76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061023191906106e7565b46145b1580156101405261044b576001600160a01b0385166102665760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831661028d5760405163d92e233d60e01b815260040160405180910390fd5b846001600160a01b031663fe6d81246040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ed91906106cc565b6001600160a01b03166382bfefc86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610328573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061034c91906106cc565b6001600160a01b031660e0816001600160a01b031681525050846001600160a01b0316631f87f3336040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103a1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c591906106cc565b6001600160a01b031661016081905260408051631057fdf960e31b815290516382bfefc8916004808201926020929091908290030181865afa15801561040d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061043191906106cc565b6001600160a01b039081166101805283166101a0526104c7565b6001600160a01b038616156104c757856001600160a01b0316633416919b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610496573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104ba91906106cc565b6001600160a01b031660e0525b505050505050506106fe565b6001600160a01b03811681146104e7575f5ffd5b50565b5f5f5f5f5f5f5f60e0888a031215610500575f5ffd5b875161050b816104d3565b602089015190975061051c816104d3565b604089015190965061052d816104d3565b606089015190955061053e816104d3565b608089015190945061054f816104d3565b60a0890151909350610560816104d3565b60c0890151909250610571816104d3565b8091505092959891949750929550565b5f60208284031215610591575f5ffd5b815160ff811681146105a1575f5ffd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b60ff82811682821603908111156105d5576105d56105a8565b92915050565b6001815b6001841115610616578085048111156105fa576105fa6105a8565b600184161561060857908102905b60019390931c9280026105df565b935093915050565b5f8261062c575060016105d5565b8161063857505f6105d5565b816001811461064e576002811461065857610674565b60019150506105d5565b60ff841115610669576106696105a8565b50506001821b6105d5565b5060208310610133831016604e8410600b8410161715610697575081810a6105d5565b6106a35f1984846105db565b805f19048211156106b6576106b66105a8565b029392505050565b5f6105a160ff84168361061e565b5f602082840312156106dc575f5ffd5b81516105a1816104d3565b5f602082840312156106f7575f5ffd5b5051919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e05161569c6108c25f395f818161023201528181610e6b0152818161110001526111a701525f81816102a601528181610dc501528181610e1801528181610f1e0152818161109a015261113e01525f818161042e01526125f901525f8181610192015261250101525f81816102d9015281816124df01526125d701525f81816103b8015281816123420152818161243b015261253301525f818161046101528181611aa701528181611b2301528181611b9f01528181611c1b01528181611c9701528181611d1301528181611d8f01528181611e9001528181611fb3015281816120d601528181612152015261402401525f818161031f015281816121ce0152818161220001526122ad01525f818161027301528181611f91015281816120b4015261240901525f818161035201528181611dc101528181611e6e01528181611ec201528181611f6f01528181611fe501528181612092015281816122df01526123e701525f818160f70152818161038501528181611847015281816118f40152818161192601526119d301525f610b14015261569c5ff3fe6080604052600436106100e7575f3560e01c80637286c0a611610087578063d737d0c711610057578063d737d0c7146103ea578063ee1e230d1461041d578063f1cefec214610450578063fa461e3314610483575f5ffd5b80637286c0a61461030e578063972ce39614610341578063ad5c464814610374578063c001b76d146103a7575f5ffd5b806327165e2e116100c257806327165e2e1461026257806327d973b41461029557806332218a6c146102c85780633593564c146102fb575f5ffd5b80630479d64414610181578063150b7a02146101d157806322c740c114610221575f5ffd5b3661017d57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480159061014457507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c155b1561017b576040517f38bbd57600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f5ffd5b34801561018c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101dc575f5ffd5b506101f06101eb3660046149f2565b6104a2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c8565b34801561022c575f5ffd5b506102547f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101c8565b34801561026d575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a0575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d3575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b61017b610309366004614a60565b6106a9565b348015610319575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561034c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561037f575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156103b2575f5ffd5b506103da7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016101c8565b3480156103f5575f5ffd5b507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6101b4565b348015610428575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561045b575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561048e575f5ffd5b5061017b61049d366004614b03565b610815565b5f7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5f036104fd576040517fb5cf512a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5c7f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075c7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315c6001600160a01b0382166105a3576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038416146105e5576040517f1b532e9b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316886001600160a01b031614610630576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808714610669576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610671610a0c565b61067b3388610a8c565b507f150b7a020000000000000000000000000000000000000000000000000000000098975050505050505050565b6106b1610b09565b8382146106ea576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80421115610724576040517f203d82d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c1561079557333014610784576040517f6f5ffb7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61079085858585610b6b565b610809565b61079d610d66565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6107cb86868686610b6b565b6107d481610e8f565b6040516001600160a01b038216907f99e0904407d080d7df635d4f68017fa5eb20cfbb1e51c1a6259a218eae490bc1905f90a2505b5050505050565b905090565b61081d610b09565b7f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b0381163314610888576040517fabae80280000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b6108b27f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5f61137d565b5f8086139085138082036108f2576040517f49133b7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f826108fe5786610900565b875b90505f61090f86880188614d0e565b6040810151909150156109ae575f81604001805161092c90614e0a565b908181525090506109a1825f0151828151811061094b5761094b614e1f565b60200260200101518360200151838151811061096957610969614e1f565b60200260200101518561097b90614e4c565b338660405160200161098d9190614ebe565b604051602081830303815290604052611384565b5050505050505050610a06565b8060a001518211156109ec576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a00816060015182608001513385611552565b50505050505b50505050565b610a367f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5f61137d565b610a607f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075f61137d565b610a8a7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315f61137d565b565b5f610a978383611607565b9050805c15610aa557505050565b610ab081600161137d565b610ada7fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461166a565b610b047f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68361166a565b505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a8a576040517f8de9ad8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b825f5b81811015610d5e575f5f610bc9888885818110610b8d57610b8d614e1f565b9050013560f81c60f81b60f881901c607f16917f8000000000000000000000000000000000000000000000000000000000000000909116151590565b9150915080610c0457610bff82878786818110610be857610be8614e1f565b9050602002810190610bfa9190614f80565b611695565b610d54565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f884901b1660208201525f9060210160408051808303601f19018152600180845283830190925292505f9190816020015b6060815260200190600190039081610c5a579050509050878786818110610c8357610c83614e1f565b9050602002810190610c959190614f80565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250855186945090925015159050610cdc57610cdc614e1f565b60209081029190910101526040517f3593564c0000000000000000000000000000000000000000000000000000000081523090633593564c90610d2890859085905f199060040161500f565b5f604051808303815f87803b158015610d3f575f5ffd5b505af1925050508015610d50575060015b5050505b5050600101610b6e565b505050505050565b610d907f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d3361137d565b610dc37ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc58610dbe344761508d565b61137d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610a8a57610e457fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b27f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661137d565b610a8a7fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55617f000000000000000000000000000000000000000000000000000000000000000061137d565b5f610eb97fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd7735612656565b90505f5b81811015611003575f610ef07fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77358361265e565b9050610f1c7f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac782612673565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610f5b5750610ffb565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610fb8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdc91906150a0565b90508015610ff857610ff86001600160a01b0383168683612682565b50505b600101610ebd565b5061102d7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77356126d0565b5f6110366126dd565b90505f81156111d2575f5f856001600160a01b0316846040515f6040518083038185875af1925050503d805f8114611089576040519150601f19603f3d011682016040523d82523d5f602084013e61108e565b606091505b5091509150816111cf577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110fa57806040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b5f6111257f0000000000000000000000000000000000000000000000000000000000000000866150f6565b90505f8111801561116757506111656001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016888361274c565b155b156111a057816040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b6111cb60017f000000000000000000000000000000000000000000000000000000000000000061508d565b9350505b50505b806111db6126dd565b1115611213576040517f60c79e6900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61121c612763565b90505f5b81811015611324575f5f6112338361278d565b9150915061124182826127ec565b61124c57505061131c565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa9250505080156112c6575060408051601f3d908101601f191682019092526112c39181019061512e565b60015b1561130f57306001600160a01b0382160361130d576040517fd30e2b5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6113198282612807565b50505b600101611220565b5061132d61281a565b6113577ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585f61137d565b6108097f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5f5b80825d5050565b5f807f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b038116156113f4576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161087f565b6114277f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c896001600160a01b031661137d565b5f876114475773fffd8963efd1fc6a506488495d951d5263988d2561144e565b6401000276a45b6040517f128acb080000000000000000000000000000000000000000000000000000000081529091506001600160a01b038a169063128acb089061149e9089908c908c9087908c90600401615149565b60408051808303815f875af11580156114b9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114dd9190615192565b90945092507f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c15611546576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038a16600482015260240161087f565b50509550959350505050565b306001600160a01b038416036115725761156d84838361286c565b610a06565b6001600160a01b03831615806115bb57507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6001600160a01b0316836001600160a01b031614155b156115f2576040517f8eb5b89100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a066001600160a01b03851684848461290b565b604080516001600160a01b03841660208201529081018290527f8d303e8787b8b7c55b97cfe6cd669d7c86fa2957639fd61f37cd6dbc0fbcb63b60608201525f906080016040516020818303038152906040528051906020012090505b92915050565b5f61167483612656565b90505f611681848361295a565b905082815d610a0684610dbe8460016151b4565b826116a457610b048282612991565b600183036116b657610b048282612ce6565b600883036116c857610b048282612f29565b600983036116da57610b048282613569565b602183036116ec57610b048282613a7f565b600e83036116fe57610b048282613b3d565b60048303611789576040517f738281980000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063738281989061175890859085906004016151f0565b5f6040518083038186803b15801561176e575f5ffd5b505af4158015611780573d5f5f3e3d5ffd5b50505050505050565b600583036117e3576040517f066cfad10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063066cfad19061175890859085906004016151f0565b600f830361183d576040517fb1fe6fd10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063b1fe6fd19061175890859085906004016151f0565b600b830361191c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166118a8576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f1fe8554200000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631fe855429061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b600c83036119fb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611987576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f704c288a0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063704c288a9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60348303611a53576040517e15460000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090621546009061175890859085906004016151f0565b60248303611acf576040517fa4dbb3b10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063a4dbb3b19061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60258303611b4b576040517f09257a65000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906309257a659061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60268303611bc7576040517f1a8ba09b00000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631a8ba09b9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60278303611c43576040517fcc08716e0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cc08716e9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60288303611cbf576040517f9baecc4800000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090639baecc489061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60228303611d3b576040517f3bba852300000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090633bba85239061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60238303611db7576040517fc58512f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063c58512f69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60298303611eb8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611e22576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f47af55b3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906347af55b39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b602a8303611fdb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611f23576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fcea3f4ff0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cea3f4ff9061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602d83036120fe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612046576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f84acbbb3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906384acbbb39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602f830361217a576040517fdce507bc0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063dce507bc9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601283036121f6576040517f852495f70000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063852495f79061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601383036122d5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612261576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7707d3b600000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637707d3b69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60148303612431577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612340576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b7f00000000000000000000000000000000000000000000000000000000000000001561239b576040517f1ce431f30000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7b232fa100000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637b232fa19061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60308303612529577f0000000000000000000000000000000000000000000000000000000000000000612493576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f8b08833000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090638b0883309061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60328303612621577f000000000000000000000000000000000000000000000000000000000000000061258b576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fef0607f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063ef0607f69061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b6040517fd76a1e9e0000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b5f815c611664565b5f5f61266a848461295a565b5c949350505050565b61267e82825f613c78565b5050565b61268f8383836001613c8a565b610b04576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b6126da815f61137d565b50565b5f477ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585c8082101561273b576040517f53dad58300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612745818361508d565b9250505090565b5f6127598484845f613c8a565b90505b9392505050565b5f6108107fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e2612656565b5f5f6127b97fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461265e565b91506127e57f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68461265e565b9050915091565b5f6127fe6127fa8484611607565b5c90565b15159392505050565b61267e6128148383611607565b5f61137d565b6128437fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e26126d0565b610a8a7f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b66126d0565b7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316836001600160a01b03161480156128b557506128b283613d05565b81115b156128f7576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b610b046001600160a01b0384168383612682565b612919848484846001613df3565b610a06576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b5f818360405160200161296f91815260200190565b604051602081830303815290604052805190602001205f1c61275c91906151b4565b5f61299e828401846152a0565b9050806060015180156129c757505f60408201515160018111156129c4576129c46153ae565b14155b156129fe576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612a18835f0151846020015160018660a00151613e79565b8451516060860151929450909250905f90612a4557612a40856020015186604001515f6144ef565b612a4f565b8460400151602001515b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612aab576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8560600151612abb5730612ade565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b604080515f80825260208201818152828401909352929350915b85811015612c8b575f86612b0d8360016151b4565b14612b185730612b1e565b8960a001515b9050306001600160a01b03821603612b5c57612b5c89612b3f8460016151b4565b81518110612b4f57612b4f614e1f565b6020026020010151614676565b5f6040518060c001604052808681526020018581526020015f81526020018b8581518110612b8c57612b8c614e1f565b60200260200101516001600160a01b03168152602001876001600160a01b031681526020018881525090505f5f612c068d5f01518681518110612bd157612bd1614e1f565b60200260200101518c8781518110612beb57612beb614e1f565b60200260200101518b878760405160200161098d9190614ebe565b915091505f8b8681518110612c1d57612c1d614e1f565b6020026020010151612c2f5782612c31565b815b90505f811315612c6d576040517f62f708cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c7681614e4c565b99503098505050505050806001019050612af8565b508760800151841015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810185905260440161087f565b50505050505050505050565b5f612cf3828401846153db565b90505f5f612d0f835f0151846020015160018660a00151613e79565b915091505f6001845f015151612d25919061508d565b9050306001600160a01b03168460a001516001600160a01b031603612d5357612d5383612b3f8360016151b4565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84604001511115612db1576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8460600151612dc15730612de4565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508460600151612dfc57612dfc8560200151614676565b5f6040518060c00160405280875f0151815260200185815260200184815260200187602001516001600160a01b03168152602001836001600160a01b03168152602001876080015181525090505f5f612ea9885f01518681518110612e6357612e63614e1f565b6020026020010151878781518110612e7d57612e7d614e1f565b60200260200101518a60400151612e9390614e4c565b8b60a001518760405160200161098d9190614ebe565b915091505f868681518110612ec057612ec0614e1f565b6020026020010151612ed25782612ed4565b815b9050886040015181612ee590614e4c565b14612f1c576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b5f612f36828401846152a0565b905080606001518015612f5f57505f6040820151516001811115612f5c57612f5c6153ae565b14155b15612f96576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612faf835f015184602001515f8660a00151613e79565b915091505f835f01515190505f838281518110612fce57612fce614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b031603612ffe57612ffe81614676565b5f85606001516130205761301b866020015187604001515f6144ef565b61302a565b8560400151602001515b9050613086866020015187606001516130435730613066565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b885180515f9061307857613078614e1f565b602002602001015184611552565b5f805b84811015613483575f5f5f8a5f015184815181106130a9576130a9614e1f565b60200260200101516001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156130ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131109190615498565b50915091505f89858151811061312857613128614e1f565b602002602001015161313a578161313c565b825b90505f8b868151811061315157613151614e1f565b60200260200101516001600160a01b03166370a082318e5f0151888151811061317c5761317c614e1f565b60200260200101516040518263ffffffff1660e01b81526004016131af91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156131ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ee91906150a0565b905081811015613256578c5180518790811061320c5761320c614e1f565b60200260200101516040517f6cda144000000000000000000000000000000000000000000000000000000000815260040161087f91906001600160a01b0391909116815260200190565b613260828261508d565b9450505050505f895f0151838151811061327c5761327c614e1f565b60200260200101516001600160a01b0316630ea099c1838b86815181106132a5576132a5614e1f565b60200260200101516040518363ffffffff1660e01b81526004016132dc9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa1580156132f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331b91906150a0565b90505f8761332a8560016151b4565b101561335c578a5161333d8560016151b4565b8151811061334d5761334d614e1f565b60200260200101519050613434565b8a608001518210156133aa5760808b01516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810183905260440161087f565b5060a08a01516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528816906370a0823190602401602060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061343191906150a0565b94505b6134758b5f0151858151811061344c5761344c614e1f565b60200260200101518a868151811061346657613466614e1f565b602002602001015184846146c1565b505050806001019050613089565b5060a08701516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908616906370a0823190602401602060405180830381865afa1580156134eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061350f91906150a0565b613519919061508d565b90508760800151811015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810182905260440161087f565b5f613576828401846153db565b90505f5f613591835f015184602001515f8660a00151613e79565b915091505f835f01515190505f8382815181106135b0576135b0614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b0316036135e0576135e081614676565b5f6135ec8360016151b4565b67ffffffffffffffff81111561360457613604614b52565b60405190808252806020026020018201604052801561362d578160200160208202803683370190505b509050856040015181848151811061364757613647614e1f565b6020908102919091010152825b801561376d5761366381614e0a565b9050865f0151818151811061367a5761367a614e1f565b60200260200101516001600160a01b031663b95d88f88383600161369e91906151b4565b815181106136ae576136ae614e1f565b6020026020010151888460016136c491906151b4565b815181106136d4576136d4614e1f565b60200260200101516040518363ffffffff1660e01b815260040161370b9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa158015613726573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061374a91906150a0565b82828151811061375c5761375c614e1f565b602002602001018181525050613654565b508560800151815f8151811061378557613785614e1f565b602002602001015111156137c5576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f86606001516137d557306137f8565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508660600151613810576138108760200151614676565b613855876020015182895f01515f8151811061382e5761382e614e1f565b6020026020010151855f8151811061384857613848614e1f565b6020026020010151611552565b5f805b85811015613998575f8661386d8360016151b4565b101561389f5789516138808360016151b4565b8151811061389057613890614e1f565b60200260200101519050613929565b5060a08901516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528716906370a0823190602401602060405180830381865afa158015613902573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061392691906150a0565b92505b61398f8a5f0151838151811061394157613941614e1f565b602002602001015189848151811061395b5761395b614e1f565b60200260200101518785600161397191906151b4565b8151811061398157613981614e1f565b6020026020010151846146c1565b50600101613858565b5060a08801516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908716906370a0823190602401602060405180830381865afa158015613a00573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a2491906150a0565b613a2e919061508d565b90508860400151811015612f1c578860400151816040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260040161087f929190918252602082015260400190565b5f80613a8d8385018561552f565b6040517f3593564c00000000000000000000000000000000000000000000000000000000815291935091503090633593564c90613ad390859085905f199060040161500f565b5f604051808303815f87803b158015613aea575f5ffd5b505af1925050508015613afb575060015b610a06573d808015613b28576040519150601f19603f3d011682016040523d82523d5f602084013e613b2d565b606091505b50613b378161475f565b50610a06565b5f8080613b4c8486018661560d565b919450925090505f6001600160a01b038416613b91576001600160a01b0383163014613b8257826001600160a01b031631613b8a565b613b8a6126dd565b9050613c33565b6001600160a01b0383163014613c27576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa158015613bfe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c2291906150a0565b613c30565b613c3084613d05565b90505b81811015610d5e576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b815f52826020528060405f205d505050565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316613cf9578383151615613ced573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b5f7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316826001600160a01b031603613d74577fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55615c613d6a6126dd565b61166491906150f6565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015613dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061166491906150a0565b6040517f23b872dd000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f51148316613e68578383151615613e5c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b6060806001600160a01b038316613ebc576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85515f819003613ef8576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613f038160016151b4565b67ffffffffffffffff811115613f1b57613f1b614b52565b604051908082528060200260200182016040528015613f44578160200160208202803683370190505b5092508067ffffffffffffffff811115613f6057613f60614b52565b604051908082528060200260200182016040528015613f89578160200160208202803683370190505b50915085835f81518110613f9f57613f9f614e1f565b60200260200101906001600160a01b031690816001600160a01b0316815250505f5b818110156144e4575f888281518110613fdc57613fdc614e1f565b60209081029190910101516040517fe3152b4c0000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301529192505f917f0000000000000000000000000000000000000000000000000000000000000000169063e3152b4c90602401602060405180830381865afa158015614069573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061408d919061512e565b90506001600160a01b0381166140da576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b6040517f5b16ebb70000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152821690635b16ebb790602401602060405180830381865afa158015614137573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061415b919061564b565b61419c576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b5f826001600160a01b031663648da8596040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141fd91906150a0565b9050881561426e577f434c0000000000000000000000000000000000000000000000000000000000008114614269576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b614300565b7f56325f564f4c4154494c4500000000000000000000000000000000000000000081141580156142be57507f56325f535441424c4500000000000000000000000000000000000000000000008114155b15614300576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b5f5f846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561433e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614362919061512e565b856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143c2919061512e565b915091505f826001600160a01b03168a88815181106143e3576143e3614e1f565b60200260200101516001600160a01b0316149050801580156144305750816001600160a01b03168a888151811061441c5761441c614e1f565b60200260200101516001600160a01b031614155b15614467576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8089888151811061447a5761447a614e1f565b91151560209283029190910190910152806144955782614497565b815b8a6144a38960016151b4565b815181106144b3576144b3614e1f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050505050806001019050613fc1565b505094509492505050565b5f8115614665575f8351600181111561450a5761450a6153ae565b14614541576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038616906370a0823190602401602060405180830381865afa15801561459e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145c291906150a0565b90506145d2858560200151614767565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa15801561462f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061465391906150a0565b61465d919061508d565b91505061275c565b61466f84846147a6565b905061275c845b6126da7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77357f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac7836147ba565b5f5f846146cf57835f6146d2565b5f845b6040517f022c0d9f00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526001600160a01b038681166044830152608060648301525f60848301529294509092509087169063022c0d9f9060a4015f604051808303815f87803b15801561474d575f5ffd5b505af1158015612cda573d5f5f3e3d5ffd5b805160208201fd5b61477082614676565b61267e6001600160a01b0383167f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c308461290b565b5f61275c836147b485613d05565b846147e8565b5f8181526020839052604090205c156147d257505050565b6147de82826001613c78565b610b04838261166a565b5f80825160018111156147fd576147fd6153ae565b0361485657828260200151111561484b576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b50602081015161275c565b620f42408260200151111561489f5781602001516040517f966987d500000000000000000000000000000000000000000000000000000000815260040161087f91815260200190565b612759838360200151620f42405f5f5f6148b9868661495c565b91509150815f036148dd578381816148d3576148d36150c9565b049250505061275c565b8184116148f4576148f46003851502601118614978565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b6001600160a01b03811681146126da575f5ffd5b80356149a881614989565b919050565b5f5f83601f8401126149bd575f5ffd5b50813567ffffffffffffffff8111156149d4575f5ffd5b6020830191508360208285010111156149eb575f5ffd5b9250929050565b5f5f5f5f5f60808688031215614a06575f5ffd5b8535614a1181614989565b94506020860135614a2181614989565b935060408601359250606086013567ffffffffffffffff811115614a43575f5ffd5b614a4f888289016149ad565b969995985093965092949392505050565b5f5f5f5f5f60608688031215614a74575f5ffd5b853567ffffffffffffffff811115614a8a575f5ffd5b614a96888289016149ad565b909650945050602086013567ffffffffffffffff811115614ab5575f5ffd5b8601601f81018813614ac5575f5ffd5b803567ffffffffffffffff811115614adb575f5ffd5b8860208260051b8401011115614aef575f5ffd5b959894975060200195604001359392505050565b5f5f5f5f60608587031215614b16575f5ffd5b8435935060208501359250604085013567ffffffffffffffff811115614b3a575f5ffd5b614b46878288016149ad565b95989497509550505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715614ba257614ba2614b52565b60405290565b6040805190810167ffffffffffffffff81118282101715614ba257614ba2614b52565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bf457614bf4614b52565b604052919050565b5f67ffffffffffffffff821115614c1557614c15614b52565b5060051b60200190565b5f82601f830112614c2e575f5ffd5b8135614c41614c3c82614bfc565b614bcb565b8082825260208201915060208360051b860101925085831115614c62575f5ffd5b602085015b83811015614c88578035614c7a81614989565b835260209283019201614c67565b5095945050505050565b80151581146126da575f5ffd5b80356149a881614c92565b5f82601f830112614cb9575f5ffd5b8135614cc7614c3c82614bfc565b8082825260208201915060208360051b860101925085831115614ce8575f5ffd5b602085015b83811015614c88578035614d0081614c92565b835260209283019201614ced565b5f60208284031215614d1e575f5ffd5b813567ffffffffffffffff811115614d34575f5ffd5b820160c08185031215614d45575f5ffd5b614d4d614b7f565b813567ffffffffffffffff811115614d63575f5ffd5b614d6f86828501614c1f565b825250602082013567ffffffffffffffff811115614d8b575f5ffd5b614d9786828501614caa565b60208301525060408281013590820152614db36060830161499d565b6060820152614dc46080830161499d565b608082015260a091820135918101919091529392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f81614e1857614e18614ddd565b505f190190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f7f80000000000000000000000000000000000000000000000000000000000000008203614e7c57614e7c614ddd565b505f0390565b5f8151808452602084019350602083015f5b82811015614eb45781511515865260209586019590910190600101614e94565b5093949350505050565b6020808252825160c083830152805160e084018190525f92919091019082906101008501905b80831015614f10576001600160a01b038451168252602082019150602084019350600183019250614ee4565b5060208601519250601f19858203016040860152614f2e8184614e82565b92505050604084015160608401526060840151614f5660808501826001600160a01b03169052565b5060808401516001600160a01b03811660a08501525060a084015160c08401528091505092915050565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614fb3575f5ffd5b83018035915067ffffffffffffffff821115614fcd575f5ffd5b6020019150368190038213156149eb575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b606081525f6150216060830186614fe1565b828103602084015280855180835260208301915060208160051b840101602088015f5b8381101561507657601f19868403018552615060838351614fe1565b6020958601959093509190910190600101615044565b505080945050505050826040830152949350505050565b8181038181111561166457611664614ddd565b5f602082840312156150b0575f5ffd5b5051919050565b602081525f61275c6020830184614fe1565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82615129577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561513e575f5ffd5b815161275c81614989565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a060808201525f61518760a0830184614fe1565b979650505050505050565b5f5f604083850312156151a3575f5ffd5b505080516020909101519092909150565b8082018082111561166457611664614ddd565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f6127596020830184866151c7565b604081525f6152166040830185876151c7565b90506001600160a01b0383166020830152949350505050565b606081525f6152426060830186886151c7565b6001600160a01b039485166020840152929093166040909101529392505050565b608081525f6152766080830187896151c7565b6001600160a01b039586166020840152938516604083015250921660609092019190915292915050565b5f602082840312156152b0575f5ffd5b813567ffffffffffffffff8111156152c6575f5ffd5b820180840360e08112156152d8575f5ffd5b6152e0614b7f565b823567ffffffffffffffff8111156152f6575f5ffd5b61530287828601614c1f565b825250602083013561531381614989565b602082015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc083011215615347575f5ffd5b61534f614ba8565b9150604083013560028110615362575f5ffd5b8252606083013560208301526040810182905261538160808401614c9f565b606082015260a08301356080820181905291506153a060c0840161499d565b60a082015295945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f602082840312156153eb575f5ffd5b813567ffffffffffffffff811115615401575f5ffd5b820160c08185031215615412575f5ffd5b61541a614b7f565b813567ffffffffffffffff811115615430575f5ffd5b61543c86828501614c1f565b825250602082013561544d81614989565b602082015260408281013590820152606082013561546a81614c92565b60608201526080828101359082015260a0909101359061548982614989565b60a08101919091529392505050565b5f5f5f606084860312156154aa575f5ffd5b5050815160208301516040909301519094929350919050565b5f82601f8301126154d2575f5ffd5b813567ffffffffffffffff8111156154ec576154ec614b52565b6154ff6020601f19601f84011601614bcb565b818152846020838601011115615513575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215615540575f5ffd5b823567ffffffffffffffff811115615556575f5ffd5b615562858286016154c3565b925050602083013567ffffffffffffffff81111561557e575f5ffd5b8301601f8101851361558e575f5ffd5b803561559c614c3c82614bfc565b8082825260208201915060208360051b8501019250878311156155bd575f5ffd5b602084015b838110156155fe57803567ffffffffffffffff8111156155e0575f5ffd5b6155ef8a6020838901016154c3565b845250602092830192016155c2565b50809450505050509250929050565b5f5f5f6060848603121561561f575f5ffd5b833561562a81614989565b9250602084013561563a81614989565b929592945050506040919091013590565b5f6020828403121561565b575f5ffd5b815161275c81614c9256fea26469706673582212200b9b76d18116ba4fbcf799f853e027611cf243b1ac3e7152fe22d5efe86925cc64736f6c63430008240033","sourceMap":"2499:46257:41:-:0;;;3499:4;3446:58;;7241:2232;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;7488:39:41;;7484:65;;7536:13;;-1:-1:-1;;;7536:13:41;;;;;;;;;;;7484:65;-1:-1:-1;;;;;7555:12:41;;;;;7573:23;;;;;7602;;;;;7631:35;;;;;7672:27;;;;;;7709:35;7705:796;;7997:12;-1:-1:-1;;;;;7971:39:41;7979:5;-1:-1:-1;;;;;7971:39:41;;7967:71;;8019:19;;-1:-1:-1;;;8019:19:41;;;;;;;;;;;7967:71;8281:26;8333:12;-1:-1:-1;;;;;8310:46:41;;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8281:77;;8393:2;8370:20;:25;;;8366:66;;;8404:28;;-1:-1:-1;;;8404:28:41;;;;;;;;;;;8366:66;8468:25;8473:20;8468:2;:25;:::i;:::-;8461:33;;:2;:33;:::i;:::-;8440:54;;-1:-1:-1;7705:796:41;-1:-1:-1;;;;;8626:33:41;;;;;;:95;;;8680:10;-1:-1:-1;;;;;8680:23:41;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8680:39:41;;:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8663:13;:58;8626:95;8616:105;;;;;8728:741;;-1:-1:-1;;;;;8753:33:41;;8749:59;;8795:13;;-1:-1:-1;;;8795:13:41;;;;;;;;;;;8749:59;-1:-1:-1;;;;;8820:44:41;;8816:70;;8873:13;;-1:-1:-1;;;8873:13:41;;;;;;;;;;;8816:70;8918:10;-1:-1:-1;;;;;8918:17:41;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8918:25:41;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8894:52:41;;;-1:-1:-1;;;;;8894:52:41;;;;;8971:10;-1:-1:-1;;;;;8971:24:41;;:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8954:43:41;;;;;9036:22;;;-1:-1:-1;;;9036:22:41;;;;:20;;:22;;;;;;;;;;;;;;;8954:43;9036:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;9005:55:41;;;;;9068:46;;;;8728:741;;;-1:-1:-1;;;;;9367:33:41;;;9363:99;;9434:10;-1:-1:-1;;;;;9434:24:41;;:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;9402:60:41;;;9363:99;7241:2232;;;;;;;2499:46257;;14:138:76;-1:-1:-1;;;;;96:31:76;;86:42;;76:70;;142:1;139;132:12;76:70;14:138;:::o;157:1260::-;433:6;441;449;457;465;473;481;534:3;522:9;513:7;509:23;505:33;502:53;;;551:1;548;541:12;502:53;583:9;577:16;602:38;634:5;602:38;:::i;:::-;709:2;694:18;;688:25;659:5;;-1:-1:-1;722:40:76;688:25;722:40;:::i;:::-;833:2;818:18;;812:25;781:7;;-1:-1:-1;846:40:76;812:25;846:40;:::i;:::-;957:2;942:18;;936:25;905:7;;-1:-1:-1;970:40:76;936:25;970:40;:::i;:::-;1081:3;1066:19;;1060:26;1029:7;;-1:-1:-1;1095:40:76;1060:26;1095:40;:::i;:::-;1206:3;1191:19;;1185:26;1154:7;;-1:-1:-1;1220:40:76;1185:26;1220:40;:::i;:::-;1331:3;1316:19;;1310:26;1279:7;;-1:-1:-1;1345:40:76;1310:26;1345:40;:::i;:::-;1404:7;1394:17;;;157:1260;;;;;;;;;;:::o;1422:273::-;1490:6;1543:2;1531:9;1522:7;1518:23;1514:32;1511:52;;;1559:1;1556;1549:12;1511:52;1591:9;1585:16;1641:4;1634:5;1630:16;1623:5;1620:27;1610:55;;1661:1;1658;1651:12;1610:55;1684:5;1422:273;-1:-1:-1;;;1422:273:76:o;1700:127::-;1761:10;1756:3;1752:20;1749:1;1742:31;1792:4;1789:1;1782:15;1816:4;1813:1;1806:15;1832:151;1922:4;1915:12;;;1901;;;1897:31;;1940:14;;1937:40;;;1957:18;;:::i;:::-;1832:151;;;;:::o;1988:375::-;2076:1;2094:5;2108:249;2129:1;2119:8;2116:15;2108:249;;;2179:4;2174:3;2170:14;2164:4;2161:24;2158:50;;;2188:18;;:::i;:::-;2238:1;2228:8;2224:16;2221:49;;;2252:16;;;;2221:49;2335:1;2331:16;;;;;2291:15;;2108:249;;;1988:375;;;;;;:::o;2368:902::-;2417:5;2447:8;2437:80;;-1:-1:-1;2488:1:76;2502:5;;2437:80;2536:4;2526:76;;-1:-1:-1;2573:1:76;2587:5;;2526:76;2618:4;2636:1;2631:59;;;;2704:1;2699:174;;;;2611:262;;2631:59;2661:1;2652:10;;2675:5;;;2699:174;2736:3;2726:8;2723:17;2720:43;;;2743:18;;:::i;:::-;-1:-1:-1;;2799:1:76;2785:16;;2858:5;;2611:262;;2957:2;2947:8;2944:16;2938:3;2932:4;2929:13;2925:36;2919:2;2909:8;2906:16;2901:2;2895:4;2892:12;2888:35;2885:77;2882:203;;;-1:-1:-1;2994:19:76;;;3070:5;;2882:203;3117:42;-1:-1:-1;;3142:8:76;3136:4;3117:42;:::i;:::-;3195:6;3191:1;3187:6;3183:19;3174:7;3171:32;3168:58;;;3206:18;;:::i;:::-;3244:20;;2368:902;-1:-1:-1;;;2368:902:76:o;3275:140::-;3333:5;3362:47;3403:4;3393:8;3389:19;3383:4;3362:47;:::i;3420:290::-;3522:6;3575:2;3563:9;3554:7;3550:23;3546:32;3543:52;;;3591:1;3588;3581:12;3543:52;3623:9;3617:16;3642:38;3674:5;3642:38;:::i;3715:184::-;3785:6;3838:2;3826:9;3817:7;3813:23;3809:32;3806:52;;;3854:1;3851;3844:12;3806:52;-1:-1:-1;3877:16:76;;3715:184;-1:-1:-1;3715:184:76:o;5009:290::-;2499:46257:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","linkReferences":{"V3/src/metarouter/libraries/ClaimsLib.sol":{"ClaimsLib":[{"start":10544,"length":20},{"start":10736,"length":20}]},"V3/src/metarouter/libraries/StakingLib.sol":{"StakingLib":[{"start":9996,"length":20},{"start":10253,"length":20}]},"V3/src/metarouter/libraries/PaymentsLib.sol":{"PaymentsLib":[{"start":8176,"length":20},{"start":8315,"length":20},{"start":8405,"length":20},{"start":8594,"length":20},{"start":8817,"length":20},{"start":8940,"length":20}]},"V3/src/metarouter/libraries/LiquidityLib.sol":{"LiquidityLib":[{"start":9649,"length":20},{"start":9773,"length":20}]},"V3/src/metarouter/libraries/ClPositionLib.sol":{"ClPositionLib":[{"start":9029,"length":20},{"start":9153,"length":20},{"start":9277,"length":20},{"start":9401,"length":20},{"start":9525,"length":20}]},"V3/src/metarouter/libraries/CrosschainLib.sol":{"CrosschainLib":[{"start":10860,"length":20},{"start":11083,"length":20},{"start":11397,"length":20}]},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"StakeRelayLib":[{"start":11645,"length":20},{"start":11893,"length":20}]}},"cborAuxdata":{"1":{"value":"0xa26469706673582212200b9b76d18116ba4fbcf799f853e027611cf243b1ac3e7152fe22d5efe86925cc64736f6c63430008240033","offset":24361}},"transformations":[{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":9029,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":9153,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":9277,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":9401,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":9525,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClaimsLib.sol:ClaimsLib","type":"replace","offset":10544,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClaimsLib.sol:ClaimsLib","type":"replace","offset":10736,"reason":"library"},{"id":"V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib","type":"replace","offset":10860,"reason":"library"},{"id":"V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib","type":"replace","offset":11083,"reason":"library"},{"id":"V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib","type":"replace","offset":11397,"reason":"library"},{"id":"V3/src/metarouter/libraries/LiquidityLib.sol:LiquidityLib","type":"replace","offset":9649,"reason":"library"},{"id":"V3/src/metarouter/libraries/LiquidityLib.sol:LiquidityLib","type":"replace","offset":9773,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":8176,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":8315,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":8405,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":8594,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":8817,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":8940,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakeRelayLib.sol:StakeRelayLib","type":"replace","offset":11645,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakeRelayLib.sol:StakeRelayLib","type":"replace","offset":11893,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakingLib.sol:StakingLib","type":"replace","offset":9996,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakingLib.sol:StakingLib","type":"replace","offset":10253,"reason":"library"},{"id":"1","type":"replace","offset":24361,"reason":"cborAuxdata"},{"type":"insert","offset":24414,"reason":"constructorArguments"}],"transformationValues":{"libraries":{"V3/src/metarouter/libraries/ClaimsLib.sol:ClaimsLib":"0x8eda4655fd8e6bb3aff3d3f36610b1efec24aa22","V3/src/metarouter/libraries/StakingLib.sol:StakingLib":"0xe463e88df582c0b7a6d530f85c2c6954fb4f3c00","V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib":"0xa37042e33c31e41b74bf18f0c1b27000f10e9e13","V3/src/metarouter/libraries/LiquidityLib.sol:LiquidityLib":"0x0028a78d20d2d5d230cc4b2a23b90793a95cb691","V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib":"0x96fa373a6d7930d67accf441529ccf3477405493","V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib":"0x47a3b182d028d503a6e6cd2bd1b4c11960d12113","V3/src/metarouter/libraries/StakeRelayLib.sol:StakeRelayLib":"0xff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e"},"cborAuxdata":{"1":"0xa2646970667358221220b8a30eb1e02532ff610779827384314975eaddd07be359e3ffd777d2332607ad64736f6c63430008240033"},"constructorArguments":"0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000382409fad8503fbcdbb27a4211551fa03e8840780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d61f078592ced81449a7405d837ff1b963b830ea0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c546122390000000000000000000000000000000000000000000000000000000000000000"}},"runtimeBytecode":{"onchainBytecode":"0x6080604052600436106100e7575f3560e01c80637286c0a611610087578063d737d0c711610057578063d737d0c7146103ea578063ee1e230d1461041d578063f1cefec214610450578063fa461e3314610483575f5ffd5b80637286c0a61461030e578063972ce39614610341578063ad5c464814610374578063c001b76d146103a7575f5ffd5b806327165e2e116100c257806327165e2e1461026257806327d973b41461029557806332218a6c146102c85780633593564c146102fb575f5ffd5b80630479d64414610181578063150b7a02146101d157806322c740c114610221575f5ffd5b3661017d57336001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2161480159061014457507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c155b1561017b576040517f38bbd57600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f5ffd5b34801561018c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101dc575f5ffd5b506101f06101eb3660046149f2565b6104a2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c8565b34801561022c575f5ffd5b506102547f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101c8565b34801561026d575f5ffd5b506101b47f0000000000000000000000009e148c5716b5aadcfd3b71ceae9ee7a9e22c29e281565b3480156102a0575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d3575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b61017b610309366004614a60565b6106a9565b348015610319575f5ffd5b506101b47f000000000000000000000000d61f078592ced81449a7405d837ff1b963b830ea81565b34801561034c575f5ffd5b506101b47f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e88407881565b34801561037f575f5ffd5b506101b47f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3480156103b2575f5ffd5b506103da7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016101c8565b3480156103f5575f5ffd5b507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6101b4565b348015610428575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561045b575f5ffd5b506101b47f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223981565b34801561048e575f5ffd5b5061017b61049d366004614b03565b610815565b5f7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5f036104fd576040517fb5cf512a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5c7f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075c7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315c6001600160a01b0382166105a3576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038416146105e5576040517f1b532e9b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316886001600160a01b031614610630576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808714610669576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610671610a0c565b61067b3388610a8c565b507f150b7a020000000000000000000000000000000000000000000000000000000098975050505050505050565b6106b1610b09565b8382146106ea576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80421115610724576040517f203d82d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c1561079557333014610784576040517f6f5ffb7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61079085858585610b6b565b610809565b61079d610d66565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6107cb86868686610b6b565b6107d481610e8f565b6040516001600160a01b038216907f99e0904407d080d7df635d4f68017fa5eb20cfbb1e51c1a6259a218eae490bc1905f90a2505b5050505050565b905090565b61081d610b09565b7f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b0381163314610888576040517fabae80280000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b6108b27f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5f61137d565b5f8086139085138082036108f2576040517f49133b7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f826108fe5786610900565b875b90505f61090f86880188614d0e565b6040810151909150156109ae575f81604001805161092c90614e0a565b908181525090506109a1825f0151828151811061094b5761094b614e1f565b60200260200101518360200151838151811061096957610969614e1f565b60200260200101518561097b90614e4c565b338660405160200161098d9190614ebe565b604051602081830303815290604052611384565b5050505050505050610a06565b8060a001518211156109ec576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a00816060015182608001513385611552565b50505050505b50505050565b610a367f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5f61137d565b610a607f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075f61137d565b610a8a7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315f61137d565b565b5f610a978383611607565b9050805c15610aa557505050565b610ab081600161137d565b610ada7fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461166a565b610b047f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68361166a565b505050565b306001600160a01b037f0000000000000000000000000fef9e88a7b76bcdbf451780c6774fe32965ee981614610a8a576040517f8de9ad8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b825f5b81811015610d5e575f5f610bc9888885818110610b8d57610b8d614e1f565b9050013560f81c60f81b60f881901c607f16917f8000000000000000000000000000000000000000000000000000000000000000909116151590565b9150915080610c0457610bff82878786818110610be857610be8614e1f565b9050602002810190610bfa9190614f80565b611695565b610d54565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f884901b1660208201525f9060210160408051808303601f19018152600180845283830190925292505f9190816020015b6060815260200190600190039081610c5a579050509050878786818110610c8357610c83614e1f565b9050602002810190610c959190614f80565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250855186945090925015159050610cdc57610cdc614e1f565b60209081029190910101526040517f3593564c0000000000000000000000000000000000000000000000000000000081523090633593564c90610d2890859085905f199060040161500f565b5f604051808303815f87803b158015610d3f575f5ffd5b505af1925050508015610d50575060015b5050505b5050600101610b6e565b505050505050565b610d907f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d3361137d565b610dc37ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc58610dbe344761508d565b61137d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610a8a57610e457fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b27f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661137d565b610a8a7fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55617f000000000000000000000000000000000000000000000000000000000000000061137d565b5f610eb97fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd7735612656565b90505f5b81811015611003575f610ef07fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77358361265e565b9050610f1c7f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac782612673565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610f5b5750610ffb565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610fb8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdc91906150a0565b90508015610ff857610ff86001600160a01b0383168683612682565b50505b600101610ebd565b5061102d7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77356126d0565b5f6110366126dd565b90505f81156111d2575f5f856001600160a01b0316846040515f6040518083038185875af1925050503d805f8114611089576040519150601f19603f3d011682016040523d82523d5f602084013e61108e565b606091505b5091509150816111cf577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110fa57806040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b5f6111257f0000000000000000000000000000000000000000000000000000000000000000866150f6565b90505f8111801561116757506111656001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016888361274c565b155b156111a057816040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b6111cb60017f000000000000000000000000000000000000000000000000000000000000000061508d565b9350505b50505b806111db6126dd565b1115611213576040517f60c79e6900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61121c612763565b90505f5b81811015611324575f5f6112338361278d565b9150915061124182826127ec565b61124c57505061131c565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa9250505080156112c6575060408051601f3d908101601f191682019092526112c39181019061512e565b60015b1561130f57306001600160a01b0382160361130d576040517fd30e2b5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6113198282612807565b50505b600101611220565b5061132d61281a565b6113577ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585f61137d565b6108097f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5f5b80825d5050565b5f807f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b038116156113f4576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161087f565b6114277f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c896001600160a01b031661137d565b5f876114475773fffd8963efd1fc6a506488495d951d5263988d2561144e565b6401000276a45b6040517f128acb080000000000000000000000000000000000000000000000000000000081529091506001600160a01b038a169063128acb089061149e9089908c908c9087908c90600401615149565b60408051808303815f875af11580156114b9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114dd9190615192565b90945092507f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c15611546576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038a16600482015260240161087f565b50509550959350505050565b306001600160a01b038416036115725761156d84838361286c565b610a06565b6001600160a01b03831615806115bb57507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6001600160a01b0316836001600160a01b031614155b156115f2576040517f8eb5b89100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a066001600160a01b03851684848461290b565b604080516001600160a01b03841660208201529081018290527f8d303e8787b8b7c55b97cfe6cd669d7c86fa2957639fd61f37cd6dbc0fbcb63b60608201525f906080016040516020818303038152906040528051906020012090505b92915050565b5f61167483612656565b90505f611681848361295a565b905082815d610a0684610dbe8460016151b4565b826116a457610b048282612991565b600183036116b657610b048282612ce6565b600883036116c857610b048282612f29565b600983036116da57610b048282613569565b602183036116ec57610b048282613a7f565b600e83036116fe57610b048282613b3d565b60048303611789576040517f7382819800000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063738281989061175890859085906004016151f0565b5f6040518083038186803b15801561176e575f5ffd5b505af4158015611780573d5f5f3e3d5ffd5b50505050505050565b600583036117e3576040517f066cfad100000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063066cfad19061175890859085906004016151f0565b600f830361183d576040517fb1fe6fd100000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063b1fe6fd19061175890859085906004016151f0565b600b830361191c577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03166118a8576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f1fe8554200000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e1390631fe855429061175890859085907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290600401615203565b600c83036119fb577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316611987576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f704c288a00000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e139063704c288a9061175890859085907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290600401615203565b60348303611a53576040517e15460000000000000000000000000000000000000000000000000000000000815273a37042e33c31e41b74bf18f0c1b27000f10e9e1390621546009061175890859085906004016151f0565b60248303611acf576040517fa4dbb3b10000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf34774054939063a4dbb3b19061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b60258303611b4b576040517f09257a650000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf3477405493906309257a659061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b60268303611bc7576040517f1a8ba09b0000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf347740549390631a8ba09b9061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b60278303611c43576040517fcc08716e0000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf34774054939063cc08716e9061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b60288303611cbf576040517f9baecc480000000000000000000000000000000000000000000000000000000081527396fa373a6d7930d67accf441529ccf347740549390639baecc489061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b60228303611d3b576040517f3bba8523000000000000000000000000000000000000000000000000000000008152730028a78d20d2d5d230cc4b2a23b90793a95cb69190633bba85239061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b60238303611db7576040517fc58512f6000000000000000000000000000000000000000000000000000000008152730028a78d20d2d5d230cc4b2a23b90793a95cb6919063c58512f69061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b60298303611eb8577f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e8840786001600160a01b0316611e22576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f47af55b300000000000000000000000000000000000000000000000000000000815273e463e88df582c0b7a6d530f85c2c6954fb4f3c00906347af55b39061175890859085907f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e884078907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c546122399060040161522f565b602a8303611fdb577f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e8840786001600160a01b0316611f23576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fcea3f4ff00000000000000000000000000000000000000000000000000000000815273e463e88df582c0b7a6d530f85c2c6954fb4f3c009063cea3f4ff9061175890859085907f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e884078907f0000000000000000000000009e148c5716b5aadcfd3b71ceae9ee7a9e22c29e2907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615263565b602d83036120fe577f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e8840786001600160a01b0316612046576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f84acbbb3000000000000000000000000000000000000000000000000000000008152738eda4655fd8e6bb3aff3d3f36610b1efec24aa22906384acbbb39061175890859085907f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e884078907f0000000000000000000000009e148c5716b5aadcfd3b71ceae9ee7a9e22c29e2907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615263565b602f830361217a576040517fdce507bc000000000000000000000000000000000000000000000000000000008152738eda4655fd8e6bb3aff3d3f36610b1efec24aa229063dce507bc9061175890859085907f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c5461223990600401615203565b601283036121f6576040517f852495f70000000000000000000000000000000000000000000000000000000081527347a3b182d028d503a6e6cd2bd1b4c11960d121139063852495f79061175890859085907f000000000000000000000000d61f078592ced81449a7405d837ff1b963b830ea90600401615203565b601383036122d5577f000000000000000000000000d61f078592ced81449a7405d837ff1b963b830ea6001600160a01b0316612261576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7707d3b60000000000000000000000000000000000000000000000000000000081527347a3b182d028d503a6e6cd2bd1b4c11960d1211390637707d3b69061175890859085907f000000000000000000000000d61f078592ced81449a7405d837ff1b963b830ea90600401615203565b60148303612431577f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e8840786001600160a01b0316612340576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b7f00000000000000000000000000000000000000000000000000000000000000001561239b576040517f1ce431f30000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7b232fa10000000000000000000000000000000000000000000000000000000081527347a3b182d028d503a6e6cd2bd1b4c11960d1211390637b232fa19061175890859085907f000000000000000000000000382409fad8503fbcdbb27a4211551fa03e884078907f0000000000000000000000009e148c5716b5aadcfd3b71ceae9ee7a9e22c29e29060040161522f565b60308303612529577f0000000000000000000000000000000000000000000000000000000000000000612493576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f8b08833000000000000000000000000000000000000000000000000000000000815273ff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e90638b0883309061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60328303612621577f000000000000000000000000000000000000000000000000000000000000000061258b576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fef0607f600000000000000000000000000000000000000000000000000000000815273ff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e9063ef0607f69061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b6040517fd76a1e9e0000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b5f815c611664565b5f5f61266a848461295a565b5c949350505050565b61267e82825f613c78565b5050565b61268f8383836001613c8a565b610b04576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b6126da815f61137d565b50565b5f477ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585c8082101561273b576040517f53dad58300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612745818361508d565b9250505090565b5f6127598484845f613c8a565b90505b9392505050565b5f6108107fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e2612656565b5f5f6127b97fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461265e565b91506127e57f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68461265e565b9050915091565b5f6127fe6127fa8484611607565b5c90565b15159392505050565b61267e6128148383611607565b5f61137d565b6128437fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e26126d0565b610a8a7f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b66126d0565b7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316836001600160a01b03161480156128b557506128b283613d05565b81115b156128f7576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b610b046001600160a01b0384168383612682565b612919848484846001613df3565b610a06576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b5f818360405160200161296f91815260200190565b604051602081830303815290604052805190602001205f1c61275c91906151b4565b5f61299e828401846152a0565b9050806060015180156129c757505f60408201515160018111156129c4576129c46153ae565b14155b156129fe576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612a18835f0151846020015160018660a00151613e79565b8451516060860151929450909250905f90612a4557612a40856020015186604001515f6144ef565b612a4f565b8460400151602001515b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612aab576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8560600151612abb5730612ade565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b604080515f80825260208201818152828401909352929350915b85811015612c8b575f86612b0d8360016151b4565b14612b185730612b1e565b8960a001515b9050306001600160a01b03821603612b5c57612b5c89612b3f8460016151b4565b81518110612b4f57612b4f614e1f565b6020026020010151614676565b5f6040518060c001604052808681526020018581526020015f81526020018b8581518110612b8c57612b8c614e1f565b60200260200101516001600160a01b03168152602001876001600160a01b031681526020018881525090505f5f612c068d5f01518681518110612bd157612bd1614e1f565b60200260200101518c8781518110612beb57612beb614e1f565b60200260200101518b878760405160200161098d9190614ebe565b915091505f8b8681518110612c1d57612c1d614e1f565b6020026020010151612c2f5782612c31565b815b90505f811315612c6d576040517f62f708cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c7681614e4c565b99503098505050505050806001019050612af8565b508760800151841015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810185905260440161087f565b50505050505050505050565b5f612cf3828401846153db565b90505f5f612d0f835f0151846020015160018660a00151613e79565b915091505f6001845f015151612d25919061508d565b9050306001600160a01b03168460a001516001600160a01b031603612d5357612d5383612b3f8360016151b4565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84604001511115612db1576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8460600151612dc15730612de4565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508460600151612dfc57612dfc8560200151614676565b5f6040518060c00160405280875f0151815260200185815260200184815260200187602001516001600160a01b03168152602001836001600160a01b03168152602001876080015181525090505f5f612ea9885f01518681518110612e6357612e63614e1f565b6020026020010151878781518110612e7d57612e7d614e1f565b60200260200101518a60400151612e9390614e4c565b8b60a001518760405160200161098d9190614ebe565b915091505f868681518110612ec057612ec0614e1f565b6020026020010151612ed25782612ed4565b815b9050886040015181612ee590614e4c565b14612f1c576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b5f612f36828401846152a0565b905080606001518015612f5f57505f6040820151516001811115612f5c57612f5c6153ae565b14155b15612f96576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612faf835f015184602001515f8660a00151613e79565b915091505f835f01515190505f838281518110612fce57612fce614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b031603612ffe57612ffe81614676565b5f85606001516130205761301b866020015187604001515f6144ef565b61302a565b8560400151602001515b9050613086866020015187606001516130435730613066565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b885180515f9061307857613078614e1f565b602002602001015184611552565b5f805b84811015613483575f5f5f8a5f015184815181106130a9576130a9614e1f565b60200260200101516001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156130ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131109190615498565b50915091505f89858151811061312857613128614e1f565b602002602001015161313a578161313c565b825b90505f8b868151811061315157613151614e1f565b60200260200101516001600160a01b03166370a082318e5f0151888151811061317c5761317c614e1f565b60200260200101516040518263ffffffff1660e01b81526004016131af91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156131ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ee91906150a0565b905081811015613256578c5180518790811061320c5761320c614e1f565b60200260200101516040517f6cda144000000000000000000000000000000000000000000000000000000000815260040161087f91906001600160a01b0391909116815260200190565b613260828261508d565b9450505050505f895f0151838151811061327c5761327c614e1f565b60200260200101516001600160a01b0316630ea099c1838b86815181106132a5576132a5614e1f565b60200260200101516040518363ffffffff1660e01b81526004016132dc9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa1580156132f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331b91906150a0565b90505f8761332a8560016151b4565b101561335c578a5161333d8560016151b4565b8151811061334d5761334d614e1f565b60200260200101519050613434565b8a608001518210156133aa5760808b01516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810183905260440161087f565b5060a08a01516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528816906370a0823190602401602060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061343191906150a0565b94505b6134758b5f0151858151811061344c5761344c614e1f565b60200260200101518a868151811061346657613466614e1f565b602002602001015184846146c1565b505050806001019050613089565b5060a08701516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908616906370a0823190602401602060405180830381865afa1580156134eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061350f91906150a0565b613519919061508d565b90508760800151811015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810182905260440161087f565b5f613576828401846153db565b90505f5f613591835f015184602001515f8660a00151613e79565b915091505f835f01515190505f8382815181106135b0576135b0614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b0316036135e0576135e081614676565b5f6135ec8360016151b4565b67ffffffffffffffff81111561360457613604614b52565b60405190808252806020026020018201604052801561362d578160200160208202803683370190505b509050856040015181848151811061364757613647614e1f565b6020908102919091010152825b801561376d5761366381614e0a565b9050865f0151818151811061367a5761367a614e1f565b60200260200101516001600160a01b031663b95d88f88383600161369e91906151b4565b815181106136ae576136ae614e1f565b6020026020010151888460016136c491906151b4565b815181106136d4576136d4614e1f565b60200260200101516040518363ffffffff1660e01b815260040161370b9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa158015613726573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061374a91906150a0565b82828151811061375c5761375c614e1f565b602002602001018181525050613654565b508560800151815f8151811061378557613785614e1f565b602002602001015111156137c5576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f86606001516137d557306137f8565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508660600151613810576138108760200151614676565b613855876020015182895f01515f8151811061382e5761382e614e1f565b6020026020010151855f8151811061384857613848614e1f565b6020026020010151611552565b5f805b85811015613998575f8661386d8360016151b4565b101561389f5789516138808360016151b4565b8151811061389057613890614e1f565b60200260200101519050613929565b5060a08901516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528716906370a0823190602401602060405180830381865afa158015613902573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061392691906150a0565b92505b61398f8a5f0151838151811061394157613941614e1f565b602002602001015189848151811061395b5761395b614e1f565b60200260200101518785600161397191906151b4565b8151811061398157613981614e1f565b6020026020010151846146c1565b50600101613858565b5060a08801516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908716906370a0823190602401602060405180830381865afa158015613a00573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a2491906150a0565b613a2e919061508d565b90508860400151811015612f1c578860400151816040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260040161087f929190918252602082015260400190565b5f80613a8d8385018561552f565b6040517f3593564c00000000000000000000000000000000000000000000000000000000815291935091503090633593564c90613ad390859085905f199060040161500f565b5f604051808303815f87803b158015613aea575f5ffd5b505af1925050508015613afb575060015b610a06573d808015613b28576040519150601f19603f3d011682016040523d82523d5f602084013e613b2d565b606091505b50613b378161475f565b50610a06565b5f8080613b4c8486018661560d565b919450925090505f6001600160a01b038416613b91576001600160a01b0383163014613b8257826001600160a01b031631613b8a565b613b8a6126dd565b9050613c33565b6001600160a01b0383163014613c27576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa158015613bfe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c2291906150a0565b613c30565b613c3084613d05565b90505b81811015610d5e576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b815f52826020528060405f205d505050565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316613cf9578383151615613ced573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b5f7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316826001600160a01b031603613d74577fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55615c613d6a6126dd565b61166491906150f6565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015613dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061166491906150a0565b6040517f23b872dd000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f51148316613e68578383151615613e5c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b6060806001600160a01b038316613ebc576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85515f819003613ef8576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613f038160016151b4565b67ffffffffffffffff811115613f1b57613f1b614b52565b604051908082528060200260200182016040528015613f44578160200160208202803683370190505b5092508067ffffffffffffffff811115613f6057613f60614b52565b604051908082528060200260200182016040528015613f89578160200160208202803683370190505b50915085835f81518110613f9f57613f9f614e1f565b60200260200101906001600160a01b031690816001600160a01b0316815250505f5b818110156144e4575f888281518110613fdc57613fdc614e1f565b60209081029190910101516040517fe3152b4c0000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301529192505f917f000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c54612239169063e3152b4c90602401602060405180830381865afa158015614069573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061408d919061512e565b90506001600160a01b0381166140da576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b6040517f5b16ebb70000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152821690635b16ebb790602401602060405180830381865afa158015614137573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061415b919061564b565b61419c576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b5f826001600160a01b031663648da8596040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141fd91906150a0565b9050881561426e577f434c0000000000000000000000000000000000000000000000000000000000008114614269576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b614300565b7f56325f564f4c4154494c4500000000000000000000000000000000000000000081141580156142be57507f56325f535441424c4500000000000000000000000000000000000000000000008114155b15614300576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b5f5f846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561433e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614362919061512e565b856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143c2919061512e565b915091505f826001600160a01b03168a88815181106143e3576143e3614e1f565b60200260200101516001600160a01b0316149050801580156144305750816001600160a01b03168a888151811061441c5761441c614e1f565b60200260200101516001600160a01b031614155b15614467576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8089888151811061447a5761447a614e1f565b91151560209283029190910190910152806144955782614497565b815b8a6144a38960016151b4565b815181106144b3576144b3614e1f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050505050806001019050613fc1565b505094509492505050565b5f8115614665575f8351600181111561450a5761450a6153ae565b14614541576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038616906370a0823190602401602060405180830381865afa15801561459e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145c291906150a0565b90506145d2858560200151614767565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa15801561462f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061465391906150a0565b61465d919061508d565b91505061275c565b61466f84846147a6565b905061275c845b6126da7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77357f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac7836147ba565b5f5f846146cf57835f6146d2565b5f845b6040517f022c0d9f00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526001600160a01b038681166044830152608060648301525f60848301529294509092509087169063022c0d9f9060a4015f604051808303815f87803b15801561474d575f5ffd5b505af1158015612cda573d5f5f3e3d5ffd5b805160208201fd5b61477082614676565b61267e6001600160a01b0383167f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c308461290b565b5f61275c836147b485613d05565b846147e8565b5f8181526020839052604090205c156147d257505050565b6147de82826001613c78565b610b04838261166a565b5f80825160018111156147fd576147fd6153ae565b0361485657828260200151111561484b576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b50602081015161275c565b620f42408260200151111561489f5781602001516040517f966987d500000000000000000000000000000000000000000000000000000000815260040161087f91815260200190565b612759838360200151620f42405f5f5f6148b9868661495c565b91509150815f036148dd578381816148d3576148d36150c9565b049250505061275c565b8184116148f4576148f46003851502601118614978565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b6001600160a01b03811681146126da575f5ffd5b80356149a881614989565b919050565b5f5f83601f8401126149bd575f5ffd5b50813567ffffffffffffffff8111156149d4575f5ffd5b6020830191508360208285010111156149eb575f5ffd5b9250929050565b5f5f5f5f5f60808688031215614a06575f5ffd5b8535614a1181614989565b94506020860135614a2181614989565b935060408601359250606086013567ffffffffffffffff811115614a43575f5ffd5b614a4f888289016149ad565b969995985093965092949392505050565b5f5f5f5f5f60608688031215614a74575f5ffd5b853567ffffffffffffffff811115614a8a575f5ffd5b614a96888289016149ad565b909650945050602086013567ffffffffffffffff811115614ab5575f5ffd5b8601601f81018813614ac5575f5ffd5b803567ffffffffffffffff811115614adb575f5ffd5b8860208260051b8401011115614aef575f5ffd5b959894975060200195604001359392505050565b5f5f5f5f60608587031215614b16575f5ffd5b8435935060208501359250604085013567ffffffffffffffff811115614b3a575f5ffd5b614b46878288016149ad565b95989497509550505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715614ba257614ba2614b52565b60405290565b6040805190810167ffffffffffffffff81118282101715614ba257614ba2614b52565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bf457614bf4614b52565b604052919050565b5f67ffffffffffffffff821115614c1557614c15614b52565b5060051b60200190565b5f82601f830112614c2e575f5ffd5b8135614c41614c3c82614bfc565b614bcb565b8082825260208201915060208360051b860101925085831115614c62575f5ffd5b602085015b83811015614c88578035614c7a81614989565b835260209283019201614c67565b5095945050505050565b80151581146126da575f5ffd5b80356149a881614c92565b5f82601f830112614cb9575f5ffd5b8135614cc7614c3c82614bfc565b8082825260208201915060208360051b860101925085831115614ce8575f5ffd5b602085015b83811015614c88578035614d0081614c92565b835260209283019201614ced565b5f60208284031215614d1e575f5ffd5b813567ffffffffffffffff811115614d34575f5ffd5b820160c08185031215614d45575f5ffd5b614d4d614b7f565b813567ffffffffffffffff811115614d63575f5ffd5b614d6f86828501614c1f565b825250602082013567ffffffffffffffff811115614d8b575f5ffd5b614d9786828501614caa565b60208301525060408281013590820152614db36060830161499d565b6060820152614dc46080830161499d565b608082015260a091820135918101919091529392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f81614e1857614e18614ddd565b505f190190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f7f80000000000000000000000000000000000000000000000000000000000000008203614e7c57614e7c614ddd565b505f0390565b5f8151808452602084019350602083015f5b82811015614eb45781511515865260209586019590910190600101614e94565b5093949350505050565b6020808252825160c083830152805160e084018190525f92919091019082906101008501905b80831015614f10576001600160a01b038451168252602082019150602084019350600183019250614ee4565b5060208601519250601f19858203016040860152614f2e8184614e82565b92505050604084015160608401526060840151614f5660808501826001600160a01b03169052565b5060808401516001600160a01b03811660a08501525060a084015160c08401528091505092915050565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614fb3575f5ffd5b83018035915067ffffffffffffffff821115614fcd575f5ffd5b6020019150368190038213156149eb575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b606081525f6150216060830186614fe1565b828103602084015280855180835260208301915060208160051b840101602088015f5b8381101561507657601f19868403018552615060838351614fe1565b6020958601959093509190910190600101615044565b505080945050505050826040830152949350505050565b8181038181111561166457611664614ddd565b5f602082840312156150b0575f5ffd5b5051919050565b602081525f61275c6020830184614fe1565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82615129577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561513e575f5ffd5b815161275c81614989565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a060808201525f61518760a0830184614fe1565b979650505050505050565b5f5f604083850312156151a3575f5ffd5b505080516020909101519092909150565b8082018082111561166457611664614ddd565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f6127596020830184866151c7565b604081525f6152166040830185876151c7565b90506001600160a01b0383166020830152949350505050565b606081525f6152426060830186886151c7565b6001600160a01b039485166020840152929093166040909101529392505050565b608081525f6152766080830187896151c7565b6001600160a01b039586166020840152938516604083015250921660609092019190915292915050565b5f602082840312156152b0575f5ffd5b813567ffffffffffffffff8111156152c6575f5ffd5b820180840360e08112156152d8575f5ffd5b6152e0614b7f565b823567ffffffffffffffff8111156152f6575f5ffd5b61530287828601614c1f565b825250602083013561531381614989565b602082015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc083011215615347575f5ffd5b61534f614ba8565b9150604083013560028110615362575f5ffd5b8252606083013560208301526040810182905261538160808401614c9f565b606082015260a08301356080820181905291506153a060c0840161499d565b60a082015295945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f602082840312156153eb575f5ffd5b813567ffffffffffffffff811115615401575f5ffd5b820160c08185031215615412575f5ffd5b61541a614b7f565b813567ffffffffffffffff811115615430575f5ffd5b61543c86828501614c1f565b825250602082013561544d81614989565b602082015260408281013590820152606082013561546a81614c92565b60608201526080828101359082015260a0909101359061548982614989565b60a08101919091529392505050565b5f5f5f606084860312156154aa575f5ffd5b5050815160208301516040909301519094929350919050565b5f82601f8301126154d2575f5ffd5b813567ffffffffffffffff8111156154ec576154ec614b52565b6154ff6020601f19601f84011601614bcb565b818152846020838601011115615513575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215615540575f5ffd5b823567ffffffffffffffff811115615556575f5ffd5b615562858286016154c3565b925050602083013567ffffffffffffffff81111561557e575f5ffd5b8301601f8101851361558e575f5ffd5b803561559c614c3c82614bfc565b8082825260208201915060208360051b8501019250878311156155bd575f5ffd5b602084015b838110156155fe57803567ffffffffffffffff8111156155e0575f5ffd5b6155ef8a6020838901016154c3565b845250602092830192016155c2565b50809450505050509250929050565b5f5f5f6060848603121561561f575f5ffd5b833561562a81614989565b9250602084013561563a81614989565b929592945050506040919091013590565b5f6020828403121561565b575f5ffd5b815161275c81614c9256fea2646970667358221220b8a30eb1e02532ff610779827384314975eaddd07be359e3ffd777d2332607ad64736f6c63430008240033","recompiledBytecode":"0x6080604052600436106100e7575f3560e01c80637286c0a611610087578063d737d0c711610057578063d737d0c7146103ea578063ee1e230d1461041d578063f1cefec214610450578063fa461e3314610483575f5ffd5b80637286c0a61461030e578063972ce39614610341578063ad5c464814610374578063c001b76d146103a7575f5ffd5b806327165e2e116100c257806327165e2e1461026257806327d973b41461029557806332218a6c146102c85780633593564c146102fb575f5ffd5b80630479d64414610181578063150b7a02146101d157806322c740c114610221575f5ffd5b3661017d57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480159061014457507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c155b1561017b576040517f38bbd57600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f5ffd5b34801561018c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101dc575f5ffd5b506101f06101eb3660046149f2565b6104a2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c8565b34801561022c575f5ffd5b506102547f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101c8565b34801561026d575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a0575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d3575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b61017b610309366004614a60565b6106a9565b348015610319575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561034c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561037f575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156103b2575f5ffd5b506103da7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016101c8565b3480156103f5575f5ffd5b507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6101b4565b348015610428575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561045b575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561048e575f5ffd5b5061017b61049d366004614b03565b610815565b5f7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5f036104fd576040517fb5cf512a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5c7f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075c7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315c6001600160a01b0382166105a3576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038416146105e5576040517f1b532e9b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316886001600160a01b031614610630576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808714610669576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610671610a0c565b61067b3388610a8c565b507f150b7a020000000000000000000000000000000000000000000000000000000098975050505050505050565b6106b1610b09565b8382146106ea576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80421115610724576040517f203d82d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c1561079557333014610784576040517f6f5ffb7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61079085858585610b6b565b610809565b61079d610d66565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6107cb86868686610b6b565b6107d481610e8f565b6040516001600160a01b038216907f99e0904407d080d7df635d4f68017fa5eb20cfbb1e51c1a6259a218eae490bc1905f90a2505b5050505050565b905090565b61081d610b09565b7f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b0381163314610888576040517fabae80280000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b6108b27f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5f61137d565b5f8086139085138082036108f2576040517f49133b7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f826108fe5786610900565b875b90505f61090f86880188614d0e565b6040810151909150156109ae575f81604001805161092c90614e0a565b908181525090506109a1825f0151828151811061094b5761094b614e1f565b60200260200101518360200151838151811061096957610969614e1f565b60200260200101518561097b90614e4c565b338660405160200161098d9190614ebe565b604051602081830303815290604052611384565b5050505050505050610a06565b8060a001518211156109ec576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a00816060015182608001513385611552565b50505050505b50505050565b610a367f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5f61137d565b610a607f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075f61137d565b610a8a7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315f61137d565b565b5f610a978383611607565b9050805c15610aa557505050565b610ab081600161137d565b610ada7fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461166a565b610b047f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68361166a565b505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a8a576040517f8de9ad8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b825f5b81811015610d5e575f5f610bc9888885818110610b8d57610b8d614e1f565b9050013560f81c60f81b60f881901c607f16917f8000000000000000000000000000000000000000000000000000000000000000909116151590565b9150915080610c0457610bff82878786818110610be857610be8614e1f565b9050602002810190610bfa9190614f80565b611695565b610d54565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f884901b1660208201525f9060210160408051808303601f19018152600180845283830190925292505f9190816020015b6060815260200190600190039081610c5a579050509050878786818110610c8357610c83614e1f565b9050602002810190610c959190614f80565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250855186945090925015159050610cdc57610cdc614e1f565b60209081029190910101526040517f3593564c0000000000000000000000000000000000000000000000000000000081523090633593564c90610d2890859085905f199060040161500f565b5f604051808303815f87803b158015610d3f575f5ffd5b505af1925050508015610d50575060015b5050505b5050600101610b6e565b505050505050565b610d907f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d3361137d565b610dc37ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc58610dbe344761508d565b61137d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610a8a57610e457fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b27f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661137d565b610a8a7fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55617f000000000000000000000000000000000000000000000000000000000000000061137d565b5f610eb97fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd7735612656565b90505f5b81811015611003575f610ef07fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77358361265e565b9050610f1c7f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac782612673565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610f5b5750610ffb565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610fb8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdc91906150a0565b90508015610ff857610ff86001600160a01b0383168683612682565b50505b600101610ebd565b5061102d7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77356126d0565b5f6110366126dd565b90505f81156111d2575f5f856001600160a01b0316846040515f6040518083038185875af1925050503d805f8114611089576040519150601f19603f3d011682016040523d82523d5f602084013e61108e565b606091505b5091509150816111cf577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110fa57806040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b5f6111257f0000000000000000000000000000000000000000000000000000000000000000866150f6565b90505f8111801561116757506111656001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016888361274c565b155b156111a057816040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b6111cb60017f000000000000000000000000000000000000000000000000000000000000000061508d565b9350505b50505b806111db6126dd565b1115611213576040517f60c79e6900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61121c612763565b90505f5b81811015611324575f5f6112338361278d565b9150915061124182826127ec565b61124c57505061131c565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa9250505080156112c6575060408051601f3d908101601f191682019092526112c39181019061512e565b60015b1561130f57306001600160a01b0382160361130d576040517fd30e2b5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6113198282612807565b50505b600101611220565b5061132d61281a565b6113577ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585f61137d565b6108097f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5f5b80825d5050565b5f807f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b038116156113f4576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161087f565b6114277f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c896001600160a01b031661137d565b5f876114475773fffd8963efd1fc6a506488495d951d5263988d2561144e565b6401000276a45b6040517f128acb080000000000000000000000000000000000000000000000000000000081529091506001600160a01b038a169063128acb089061149e9089908c908c9087908c90600401615149565b60408051808303815f875af11580156114b9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114dd9190615192565b90945092507f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c15611546576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038a16600482015260240161087f565b50509550959350505050565b306001600160a01b038416036115725761156d84838361286c565b610a06565b6001600160a01b03831615806115bb57507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6001600160a01b0316836001600160a01b031614155b156115f2576040517f8eb5b89100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a066001600160a01b03851684848461290b565b604080516001600160a01b03841660208201529081018290527f8d303e8787b8b7c55b97cfe6cd669d7c86fa2957639fd61f37cd6dbc0fbcb63b60608201525f906080016040516020818303038152906040528051906020012090505b92915050565b5f61167483612656565b90505f611681848361295a565b905082815d610a0684610dbe8460016151b4565b826116a457610b048282612991565b600183036116b657610b048282612ce6565b600883036116c857610b048282612f29565b600983036116da57610b048282613569565b602183036116ec57610b048282613a7f565b600e83036116fe57610b048282613b3d565b60048303611789576040517f738281980000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063738281989061175890859085906004016151f0565b5f6040518083038186803b15801561176e575f5ffd5b505af4158015611780573d5f5f3e3d5ffd5b50505050505050565b600583036117e3576040517f066cfad10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063066cfad19061175890859085906004016151f0565b600f830361183d576040517fb1fe6fd10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063b1fe6fd19061175890859085906004016151f0565b600b830361191c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166118a8576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f1fe8554200000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631fe855429061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b600c83036119fb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611987576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f704c288a0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063704c288a9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60348303611a53576040517e15460000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090621546009061175890859085906004016151f0565b60248303611acf576040517fa4dbb3b10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063a4dbb3b19061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60258303611b4b576040517f09257a65000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906309257a659061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60268303611bc7576040517f1a8ba09b00000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631a8ba09b9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60278303611c43576040517fcc08716e0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cc08716e9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60288303611cbf576040517f9baecc4800000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090639baecc489061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60228303611d3b576040517f3bba852300000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090633bba85239061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60238303611db7576040517fc58512f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063c58512f69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60298303611eb8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611e22576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f47af55b3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906347af55b39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b602a8303611fdb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611f23576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fcea3f4ff0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cea3f4ff9061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602d83036120fe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612046576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f84acbbb3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906384acbbb39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602f830361217a576040517fdce507bc0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063dce507bc9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601283036121f6576040517f852495f70000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063852495f79061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601383036122d5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612261576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7707d3b600000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637707d3b69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60148303612431577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612340576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b7f00000000000000000000000000000000000000000000000000000000000000001561239b576040517f1ce431f30000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7b232fa100000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637b232fa19061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60308303612529577f0000000000000000000000000000000000000000000000000000000000000000612493576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f8b08833000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090638b0883309061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60328303612621577f000000000000000000000000000000000000000000000000000000000000000061258b576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fef0607f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063ef0607f69061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b6040517fd76a1e9e0000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b5f815c611664565b5f5f61266a848461295a565b5c949350505050565b61267e82825f613c78565b5050565b61268f8383836001613c8a565b610b04576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b6126da815f61137d565b50565b5f477ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585c8082101561273b576040517f53dad58300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612745818361508d565b9250505090565b5f6127598484845f613c8a565b90505b9392505050565b5f6108107fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e2612656565b5f5f6127b97fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461265e565b91506127e57f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68461265e565b9050915091565b5f6127fe6127fa8484611607565b5c90565b15159392505050565b61267e6128148383611607565b5f61137d565b6128437fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e26126d0565b610a8a7f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b66126d0565b7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316836001600160a01b03161480156128b557506128b283613d05565b81115b156128f7576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b610b046001600160a01b0384168383612682565b612919848484846001613df3565b610a06576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b5f818360405160200161296f91815260200190565b604051602081830303815290604052805190602001205f1c61275c91906151b4565b5f61299e828401846152a0565b9050806060015180156129c757505f60408201515160018111156129c4576129c46153ae565b14155b156129fe576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612a18835f0151846020015160018660a00151613e79565b8451516060860151929450909250905f90612a4557612a40856020015186604001515f6144ef565b612a4f565b8460400151602001515b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612aab576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8560600151612abb5730612ade565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b604080515f80825260208201818152828401909352929350915b85811015612c8b575f86612b0d8360016151b4565b14612b185730612b1e565b8960a001515b9050306001600160a01b03821603612b5c57612b5c89612b3f8460016151b4565b81518110612b4f57612b4f614e1f565b6020026020010151614676565b5f6040518060c001604052808681526020018581526020015f81526020018b8581518110612b8c57612b8c614e1f565b60200260200101516001600160a01b03168152602001876001600160a01b031681526020018881525090505f5f612c068d5f01518681518110612bd157612bd1614e1f565b60200260200101518c8781518110612beb57612beb614e1f565b60200260200101518b878760405160200161098d9190614ebe565b915091505f8b8681518110612c1d57612c1d614e1f565b6020026020010151612c2f5782612c31565b815b90505f811315612c6d576040517f62f708cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c7681614e4c565b99503098505050505050806001019050612af8565b508760800151841015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810185905260440161087f565b50505050505050505050565b5f612cf3828401846153db565b90505f5f612d0f835f0151846020015160018660a00151613e79565b915091505f6001845f015151612d25919061508d565b9050306001600160a01b03168460a001516001600160a01b031603612d5357612d5383612b3f8360016151b4565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84604001511115612db1576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8460600151612dc15730612de4565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508460600151612dfc57612dfc8560200151614676565b5f6040518060c00160405280875f0151815260200185815260200184815260200187602001516001600160a01b03168152602001836001600160a01b03168152602001876080015181525090505f5f612ea9885f01518681518110612e6357612e63614e1f565b6020026020010151878781518110612e7d57612e7d614e1f565b60200260200101518a60400151612e9390614e4c565b8b60a001518760405160200161098d9190614ebe565b915091505f868681518110612ec057612ec0614e1f565b6020026020010151612ed25782612ed4565b815b9050886040015181612ee590614e4c565b14612f1c576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b5f612f36828401846152a0565b905080606001518015612f5f57505f6040820151516001811115612f5c57612f5c6153ae565b14155b15612f96576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612faf835f015184602001515f8660a00151613e79565b915091505f835f01515190505f838281518110612fce57612fce614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b031603612ffe57612ffe81614676565b5f85606001516130205761301b866020015187604001515f6144ef565b61302a565b8560400151602001515b9050613086866020015187606001516130435730613066565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b885180515f9061307857613078614e1f565b602002602001015184611552565b5f805b84811015613483575f5f5f8a5f015184815181106130a9576130a9614e1f565b60200260200101516001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156130ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131109190615498565b50915091505f89858151811061312857613128614e1f565b602002602001015161313a578161313c565b825b90505f8b868151811061315157613151614e1f565b60200260200101516001600160a01b03166370a082318e5f0151888151811061317c5761317c614e1f565b60200260200101516040518263ffffffff1660e01b81526004016131af91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156131ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ee91906150a0565b905081811015613256578c5180518790811061320c5761320c614e1f565b60200260200101516040517f6cda144000000000000000000000000000000000000000000000000000000000815260040161087f91906001600160a01b0391909116815260200190565b613260828261508d565b9450505050505f895f0151838151811061327c5761327c614e1f565b60200260200101516001600160a01b0316630ea099c1838b86815181106132a5576132a5614e1f565b60200260200101516040518363ffffffff1660e01b81526004016132dc9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa1580156132f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331b91906150a0565b90505f8761332a8560016151b4565b101561335c578a5161333d8560016151b4565b8151811061334d5761334d614e1f565b60200260200101519050613434565b8a608001518210156133aa5760808b01516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810183905260440161087f565b5060a08a01516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528816906370a0823190602401602060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061343191906150a0565b94505b6134758b5f0151858151811061344c5761344c614e1f565b60200260200101518a868151811061346657613466614e1f565b602002602001015184846146c1565b505050806001019050613089565b5060a08701516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908616906370a0823190602401602060405180830381865afa1580156134eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061350f91906150a0565b613519919061508d565b90508760800151811015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810182905260440161087f565b5f613576828401846153db565b90505f5f613591835f015184602001515f8660a00151613e79565b915091505f835f01515190505f8382815181106135b0576135b0614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b0316036135e0576135e081614676565b5f6135ec8360016151b4565b67ffffffffffffffff81111561360457613604614b52565b60405190808252806020026020018201604052801561362d578160200160208202803683370190505b509050856040015181848151811061364757613647614e1f565b6020908102919091010152825b801561376d5761366381614e0a565b9050865f0151818151811061367a5761367a614e1f565b60200260200101516001600160a01b031663b95d88f88383600161369e91906151b4565b815181106136ae576136ae614e1f565b6020026020010151888460016136c491906151b4565b815181106136d4576136d4614e1f565b60200260200101516040518363ffffffff1660e01b815260040161370b9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa158015613726573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061374a91906150a0565b82828151811061375c5761375c614e1f565b602002602001018181525050613654565b508560800151815f8151811061378557613785614e1f565b602002602001015111156137c5576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f86606001516137d557306137f8565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508660600151613810576138108760200151614676565b613855876020015182895f01515f8151811061382e5761382e614e1f565b6020026020010151855f8151811061384857613848614e1f565b6020026020010151611552565b5f805b85811015613998575f8661386d8360016151b4565b101561389f5789516138808360016151b4565b8151811061389057613890614e1f565b60200260200101519050613929565b5060a08901516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528716906370a0823190602401602060405180830381865afa158015613902573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061392691906150a0565b92505b61398f8a5f0151838151811061394157613941614e1f565b602002602001015189848151811061395b5761395b614e1f565b60200260200101518785600161397191906151b4565b8151811061398157613981614e1f565b6020026020010151846146c1565b50600101613858565b5060a08801516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908716906370a0823190602401602060405180830381865afa158015613a00573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a2491906150a0565b613a2e919061508d565b90508860400151811015612f1c578860400151816040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260040161087f929190918252602082015260400190565b5f80613a8d8385018561552f565b6040517f3593564c00000000000000000000000000000000000000000000000000000000815291935091503090633593564c90613ad390859085905f199060040161500f565b5f604051808303815f87803b158015613aea575f5ffd5b505af1925050508015613afb575060015b610a06573d808015613b28576040519150601f19603f3d011682016040523d82523d5f602084013e613b2d565b606091505b50613b378161475f565b50610a06565b5f8080613b4c8486018661560d565b919450925090505f6001600160a01b038416613b91576001600160a01b0383163014613b8257826001600160a01b031631613b8a565b613b8a6126dd565b9050613c33565b6001600160a01b0383163014613c27576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa158015613bfe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c2291906150a0565b613c30565b613c3084613d05565b90505b81811015610d5e576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b815f52826020528060405f205d505050565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316613cf9578383151615613ced573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b5f7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316826001600160a01b031603613d74577fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55615c613d6a6126dd565b61166491906150f6565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015613dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061166491906150a0565b6040517f23b872dd000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f51148316613e68578383151615613e5c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b6060806001600160a01b038316613ebc576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85515f819003613ef8576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613f038160016151b4565b67ffffffffffffffff811115613f1b57613f1b614b52565b604051908082528060200260200182016040528015613f44578160200160208202803683370190505b5092508067ffffffffffffffff811115613f6057613f60614b52565b604051908082528060200260200182016040528015613f89578160200160208202803683370190505b50915085835f81518110613f9f57613f9f614e1f565b60200260200101906001600160a01b031690816001600160a01b0316815250505f5b818110156144e4575f888281518110613fdc57613fdc614e1f565b60209081029190910101516040517fe3152b4c0000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301529192505f917f0000000000000000000000000000000000000000000000000000000000000000169063e3152b4c90602401602060405180830381865afa158015614069573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061408d919061512e565b90506001600160a01b0381166140da576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b6040517f5b16ebb70000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152821690635b16ebb790602401602060405180830381865afa158015614137573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061415b919061564b565b61419c576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b5f826001600160a01b031663648da8596040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141fd91906150a0565b9050881561426e577f434c0000000000000000000000000000000000000000000000000000000000008114614269576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b614300565b7f56325f564f4c4154494c4500000000000000000000000000000000000000000081141580156142be57507f56325f535441424c4500000000000000000000000000000000000000000000008114155b15614300576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b5f5f846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561433e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614362919061512e565b856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143c2919061512e565b915091505f826001600160a01b03168a88815181106143e3576143e3614e1f565b60200260200101516001600160a01b0316149050801580156144305750816001600160a01b03168a888151811061441c5761441c614e1f565b60200260200101516001600160a01b031614155b15614467576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8089888151811061447a5761447a614e1f565b91151560209283029190910190910152806144955782614497565b815b8a6144a38960016151b4565b815181106144b3576144b3614e1f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050505050806001019050613fc1565b505094509492505050565b5f8115614665575f8351600181111561450a5761450a6153ae565b14614541576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038616906370a0823190602401602060405180830381865afa15801561459e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145c291906150a0565b90506145d2858560200151614767565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa15801561462f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061465391906150a0565b61465d919061508d565b91505061275c565b61466f84846147a6565b905061275c845b6126da7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77357f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac7836147ba565b5f5f846146cf57835f6146d2565b5f845b6040517f022c0d9f00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526001600160a01b038681166044830152608060648301525f60848301529294509092509087169063022c0d9f9060a4015f604051808303815f87803b15801561474d575f5ffd5b505af1158015612cda573d5f5f3e3d5ffd5b805160208201fd5b61477082614676565b61267e6001600160a01b0383167f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c308461290b565b5f61275c836147b485613d05565b846147e8565b5f8181526020839052604090205c156147d257505050565b6147de82826001613c78565b610b04838261166a565b5f80825160018111156147fd576147fd6153ae565b0361485657828260200151111561484b576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b50602081015161275c565b620f42408260200151111561489f5781602001516040517f966987d500000000000000000000000000000000000000000000000000000000815260040161087f91815260200190565b612759838360200151620f42405f5f5f6148b9868661495c565b91509150815f036148dd578381816148d3576148d36150c9565b049250505061275c565b8184116148f4576148f46003851502601118614978565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b6001600160a01b03811681146126da575f5ffd5b80356149a881614989565b919050565b5f5f83601f8401126149bd575f5ffd5b50813567ffffffffffffffff8111156149d4575f5ffd5b6020830191508360208285010111156149eb575f5ffd5b9250929050565b5f5f5f5f5f60808688031215614a06575f5ffd5b8535614a1181614989565b94506020860135614a2181614989565b935060408601359250606086013567ffffffffffffffff811115614a43575f5ffd5b614a4f888289016149ad565b969995985093965092949392505050565b5f5f5f5f5f60608688031215614a74575f5ffd5b853567ffffffffffffffff811115614a8a575f5ffd5b614a96888289016149ad565b909650945050602086013567ffffffffffffffff811115614ab5575f5ffd5b8601601f81018813614ac5575f5ffd5b803567ffffffffffffffff811115614adb575f5ffd5b8860208260051b8401011115614aef575f5ffd5b959894975060200195604001359392505050565b5f5f5f5f60608587031215614b16575f5ffd5b8435935060208501359250604085013567ffffffffffffffff811115614b3a575f5ffd5b614b46878288016149ad565b95989497509550505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715614ba257614ba2614b52565b60405290565b6040805190810167ffffffffffffffff81118282101715614ba257614ba2614b52565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bf457614bf4614b52565b604052919050565b5f67ffffffffffffffff821115614c1557614c15614b52565b5060051b60200190565b5f82601f830112614c2e575f5ffd5b8135614c41614c3c82614bfc565b614bcb565b8082825260208201915060208360051b860101925085831115614c62575f5ffd5b602085015b83811015614c88578035614c7a81614989565b835260209283019201614c67565b5095945050505050565b80151581146126da575f5ffd5b80356149a881614c92565b5f82601f830112614cb9575f5ffd5b8135614cc7614c3c82614bfc565b8082825260208201915060208360051b860101925085831115614ce8575f5ffd5b602085015b83811015614c88578035614d0081614c92565b835260209283019201614ced565b5f60208284031215614d1e575f5ffd5b813567ffffffffffffffff811115614d34575f5ffd5b820160c08185031215614d45575f5ffd5b614d4d614b7f565b813567ffffffffffffffff811115614d63575f5ffd5b614d6f86828501614c1f565b825250602082013567ffffffffffffffff811115614d8b575f5ffd5b614d9786828501614caa565b60208301525060408281013590820152614db36060830161499d565b6060820152614dc46080830161499d565b608082015260a091820135918101919091529392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f81614e1857614e18614ddd565b505f190190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f7f80000000000000000000000000000000000000000000000000000000000000008203614e7c57614e7c614ddd565b505f0390565b5f8151808452602084019350602083015f5b82811015614eb45781511515865260209586019590910190600101614e94565b5093949350505050565b6020808252825160c083830152805160e084018190525f92919091019082906101008501905b80831015614f10576001600160a01b038451168252602082019150602084019350600183019250614ee4565b5060208601519250601f19858203016040860152614f2e8184614e82565b92505050604084015160608401526060840151614f5660808501826001600160a01b03169052565b5060808401516001600160a01b03811660a08501525060a084015160c08401528091505092915050565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614fb3575f5ffd5b83018035915067ffffffffffffffff821115614fcd575f5ffd5b6020019150368190038213156149eb575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b606081525f6150216060830186614fe1565b828103602084015280855180835260208301915060208160051b840101602088015f5b8381101561507657601f19868403018552615060838351614fe1565b6020958601959093509190910190600101615044565b505080945050505050826040830152949350505050565b8181038181111561166457611664614ddd565b5f602082840312156150b0575f5ffd5b5051919050565b602081525f61275c6020830184614fe1565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82615129577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561513e575f5ffd5b815161275c81614989565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a060808201525f61518760a0830184614fe1565b979650505050505050565b5f5f604083850312156151a3575f5ffd5b505080516020909101519092909150565b8082018082111561166457611664614ddd565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f6127596020830184866151c7565b604081525f6152166040830185876151c7565b90506001600160a01b0383166020830152949350505050565b606081525f6152426060830186886151c7565b6001600160a01b039485166020840152929093166040909101529392505050565b608081525f6152766080830187896151c7565b6001600160a01b039586166020840152938516604083015250921660609092019190915292915050565b5f602082840312156152b0575f5ffd5b813567ffffffffffffffff8111156152c6575f5ffd5b820180840360e08112156152d8575f5ffd5b6152e0614b7f565b823567ffffffffffffffff8111156152f6575f5ffd5b61530287828601614c1f565b825250602083013561531381614989565b602082015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc083011215615347575f5ffd5b61534f614ba8565b9150604083013560028110615362575f5ffd5b8252606083013560208301526040810182905261538160808401614c9f565b606082015260a08301356080820181905291506153a060c0840161499d565b60a082015295945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f602082840312156153eb575f5ffd5b813567ffffffffffffffff811115615401575f5ffd5b820160c08185031215615412575f5ffd5b61541a614b7f565b813567ffffffffffffffff811115615430575f5ffd5b61543c86828501614c1f565b825250602082013561544d81614989565b602082015260408281013590820152606082013561546a81614c92565b60608201526080828101359082015260a0909101359061548982614989565b60a08101919091529392505050565b5f5f5f606084860312156154aa575f5ffd5b5050815160208301516040909301519094929350919050565b5f82601f8301126154d2575f5ffd5b813567ffffffffffffffff8111156154ec576154ec614b52565b6154ff6020601f19601f84011601614bcb565b818152846020838601011115615513575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215615540575f5ffd5b823567ffffffffffffffff811115615556575f5ffd5b615562858286016154c3565b925050602083013567ffffffffffffffff81111561557e575f5ffd5b8301601f8101851361558e575f5ffd5b803561559c614c3c82614bfc565b8082825260208201915060208360051b8501019250878311156155bd575f5ffd5b602084015b838110156155fe57803567ffffffffffffffff8111156155e0575f5ffd5b6155ef8a6020838901016154c3565b845250602092830192016155c2565b50809450505050509250929050565b5f5f5f6060848603121561561f575f5ffd5b833561562a81614989565b9250602084013561563a81614989565b929592945050506040919091013590565b5f6020828403121561565b575f5ffd5b815161275c81614c9256fea26469706673582212200b9b76d18116ba4fbcf799f853e027611cf243b1ac3e7152fe22d5efe86925cc64736f6c63430008240033","sourceMap":"2499:46257:41:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9764:10;-1:-1:-1;;;;;9786:4:41;9764:27;;;;;:87;;-1:-1:-1;1398:47:51;4769:12:42;9795:56:41;9764:87;9760:133;;;9868:18;;;;;;;;;;;;;;9760:133;2499:46257;;;;;4056:37;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;194:55:76;;;176:74;;164:2;149:18;4056:37:41;;;;;;;;11436:1187;;;;;;;;;;-1:-1:-1;11436:1187:41;;;;;:::i;:::-;;:::i;:::-;;;1896:66:76;1884:79;;;1866:98;;1854:2;1839:18;11436:1187:41;1722:248:76;4292:43:41;;;;;;;;;;;;;;;;;;2121:25:76;;;2109:2;2094:18;4292:43:41;1975:177:76;3672:38:41;;;;;;;;;;;;;;;4222:36;;;;;;;;;;;;;;;3977:45;;;;;;;;;;;;;;;12735:741;;;;;;:::i;:::-;;:::i;3744:52::-;;;;;;;;;;;;;;;3600:38;;;;;;;;;;;;;;;3539:27;;;;;;;;;;;;;;;3914:29;;;;;;;;;;;;;;;;;;4377:14:76;;4370:22;4352:41;;4340:2;4325:18;3914:29:41;4212:187:76;15165:123:41;;;;;;;;;;-1:-1:-1;1398:47:51;4769:12:42;15165:123:41;;4127:61;;;;;;;;;;;;;;;3830:50;;;;;;;;;;;;;;;13510:1621;;;;;;;;;;-1:-1:-1;13510:1621:41;;;;;:::i;:::-;;:::i;11436:1187::-;11566:16;1398:47:51;4769:12:42;11649:1:41;11594:56;11590:85;;11659:16;;;;;;;;;;;;;;11590:85;5515:53:51;4769:12:42;5901:49:51;4769:12:42;6162:50:51;4769:12:42;-1:-1:-1;;;;;11989:29:41;;11985:63;;12027:21;;;;;;;;;;;;;;11985:63;12058:10;-1:-1:-1;;;;;12058:33:41;;;12054:64;;12100:18;;;;;;;;;;;;;;12054:64;12137:15;-1:-1:-1;;;;;12128:24:41;:5;-1:-1:-1;;;;;12128:24:41;;12124:58;;12161:21;;;;;;;;;;;;;;12124:58;12204:16;12192:8;:28;12188:62;;12229:21;;;;;;;;;;;;;;12188:62;12478:34;:32;:34::i;:::-;12518:46;12543:10;12555:8;12518:24;:46::i;:::-;-1:-1:-1;12577:41:41;;11436:1187;-1:-1:-1;;;;;;;;11436:1187:41:o;12735:741::-;12854:24;:22;:24::i;:::-;12888:34;;;12884:63;;12931:16;;;;;;;;;;;;;;12884:63;12975:9;12957:15;:27;12953:49;;;12993:9;;;;;;;;;;;;;;12953:49;1398:47:51;4769:12:42;13013:56:41;13009:285;;13177:10;13199:4;13177:27;13173:56;;13213:16;;;;;;;;;;;;;;13173:56;13237:36;13254:9;;13265:7;;13237:16;:36::i;:::-;13281:7;;13009:285;13300:17;:15;:17::i;:::-;1398:47:51;4769:12:42;13374:36:41;13391:9;;13402:7;;13374:16;:36::i;:::-;13416:22;13430:7;13416:13;:22::i;:::-;13449;;-1:-1:-1;;;;;13449:22:41;;;;;;;;12848:628;12735:741;;;;;;:::o;15256:27::-;15249:34;;15165:123;:::o;13510:1621::-;13630:24;:22;:24::i;:::-;3057:46:51;4769:12:42;-1:-1:-1;;;;;13899:29:41;;:10;:29;13895:75;;13937:33;;;;;13959:10;13937:33;;;176:74:76;149:18;;13937:33:41;;;;;;;;13895:75;13976:73;3057:46:51;14047:1:41;13976:23;:73::i;:::-;14122:21;14146:17;;;;14193;;14220:36;;;14216:72;;14265:23;;;;;;;;;;;;;;14216:72;14295:20;14326:16;:48;;14361:13;14326:48;;;14345:13;14326:48;14295:80;-1:-1:-1;14381:35:41;14419:39;;;;14430:5;14419:39;:::i;:::-;14570:19;;;;14381:77;;-1:-1:-1;14570:23:41;14566:337;;14603:12;14620:9;:19;;14618:21;;;;;:::i;:::-;;;;;;14603:36;;14750:132;14767:9;:15;;;14783:4;14767:21;;;;;;;;:::i;:::-;;;;;;;14790:9;:20;;;14811:4;14790:26;;;;;;;;:::i;:::-;;;;;;;14826:12;14818:21;;;:::i;:::-;14841:10;14864:9;14853:21;;;;;;;;:::i;:::-;;;;;;;;;;;;;14750:7;:132::i;:::-;;;14890:7;;;;;;;;14566:337;14998:9;:21;;;14983:12;:36;14979:67;;;15028:18;;;;;;;;;;;;;;14979:67;15052:74;15065:9;:17;;;15084:9;:15;;;15101:10;15113:12;15052;:74::i;:::-;13624:1507;;;;;13510:1621;;;;;:::o;10312:222:51:-;10355:56;5515:53;10409:1;10355:23;:56::i;:::-;10417:52;5901:49;10467:1;10417:23;:52::i;:::-;10475:54;6162:50;10527:1;10475:23;:54::i;:::-;10312:222::o;6891:366::-;6963:17;6983:35;6996:11;7009:8;6983:12;:35::i;:::-;6963:55;-1:-1:-1;4769:12:42;;7028:38:51;7024:51;;7068:7;6891:366;;:::o;7024:51::-;7080:37;7104:9;7115:1;7080:23;:37::i;:::-;7123:62;3861:51;7173:11;7123:22;:62::i;:::-;7191:61;4188:48;7243:8;7191:26;:61::i;:::-;6957:300;6891:366;;:::o;46739:132:41:-;46813:4;-1:-1:-1;;;;;46822:15:41;46805:32;;46801:65;;46846:20;;;;;;;;;;;;;;15513:734;15632:9;15614:15;15654:589;15676:7;15671:2;:12;15654:589;;;15700:20;15722:17;15743:22;15751:9;;15761:2;15751:13;;;;;;;:::i;:::-;;;;;;;;;48379:26;48358:48;;;5742:4:46;48358:48:41;;48443:26;48428:41;;;:46;;;48219:260;15743:22;15699:66;;;;15778:12;15773:464;;15802:36;15812:12;15826:7;;15834:2;15826:11;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;15802:9;:36::i;:::-;15773:464;;;15893:45;;13431:66:76;15910:27:41;;;;13419:79:76;15893:45:41;;;13407:92:76;15863:27:41;;13515:11:76;;15893:45:41;;;;;;-1:-1:-1;;15893:45:41;;;15990:1;15978:14;;;;;;;;;15893:45;-1:-1:-1;15948:27:41;;15893:45;15978:14;;;;;;;;;;;;;;;;;;;;15948:44;;16020:7;;16028:2;16020:11;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;16002:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16002:15:41;;:12;;-1:-1:-1;16002:29:41;;-1:-1:-1;16002:15:41;;;-1:-1:-1;16002:15:41;;;;:::i;:::-;;;;;;;;;;:29;16156:61;;;;;:4;;:12;;:61;;16169:14;;16185:12;;-1:-1:-1;;16199:17:41;16156:61;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;16152:77;15853:384;;15773:464;-1:-1:-1;;15685:4:41;;15654:589;;;;15608:639;15513:734;;;;:::o;16437:730::-;16487:82;1398:47:51;16556:10:41;16487:23;:82::i;:::-;16575:102;1647:54:51;16643:33:41;16667:9;16643:21;:33;:::i;:::-;16575:23;:102::i;:::-;16928:12;-1:-1:-1;;;;;16920:35:41;;16916:247;;16965:99;2190:52:51;17048:12:41;-1:-1:-1;;;;;17024:39:41;16965:23;:99::i;:::-;17072:84;2808:57:51;17137:18:41;17072:23;:84::i;19079:4402::-;19145:15;19163:58;3533:48:51;19163:24:41;:58::i;:::-;19145:76;;19232:10;19227:598;19249:7;19244:2;:12;19227:598;;;19272:14;19289:58;3533:48:51;19344:2:41;19289:20;:58::i;:::-;19272:75;;19355:63;3295:50:51;19411:6:41;19355:25;:63::i;:::-;19654:12;-1:-1:-1;;;;;19636:31:41;:6;-1:-1:-1;;;;;19636:31:41;;19632:45;;19669:8;;;19632:45;19704:39;;;;;19737:4;19704:39;;;176:74:76;19685:16:41;;-1:-1:-1;;;;;19704:24:41;;;;;149:18:76;;19704:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;19685:58;-1:-1:-1;19755:12:41;;19751:67;;19769:49;-1:-1:-1;;;;;19769:27:41;;19797:10;19809:8;19769:27;:49::i;:::-;19264:561;;19227:598;19258:4;;19227:598;;;;19830:57;3533:48:51;19830:23:41;:57::i;:::-;19894:21;19918:40;:38;:40::i;:::-;19894:64;-1:-1:-1;20017:20:41;20047:17;;20043:957;;20075:13;20090:18;20120:10;-1:-1:-1;;;;;20112:24:41;20144:13;20112:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;20074:88;;;;20175:8;20170:824;;20658:12;-1:-1:-1;;;;;20650:35:41;20646:75;;20715:5;20694:27;;;;;;;;;;;:::i;20646:75::-;20731:21;20755:34;20771:18;20755:13;:34;:::i;:::-;20731:58;;20819:1;20803:13;:17;:77;;;;-1:-1:-1;20825:55:41;-1:-1:-1;;;;;20825:12:41;:28;20854:10;20866:13;20825:28;:55::i;:::-;20824:56;20803:77;20799:140;;;20922:5;20901:27;;;;;;;;;;;:::i;20799:140::-;20963:22;20984:1;20963:18;:22;:::i;:::-;20948:37;;20185:809;20170:824;20066:934;;20043:957;21422:12;21379:40;:38;:40::i;:::-;:55;21375:93;;;21443:25;;;;;;;;;;;;;;21375:93;21802:18;21823:34;:32;:34::i;:::-;21802:55;;21868:10;21863:1438;21885:10;21880:2;:15;21863:1438;;;21912:19;21933:16;21953:32;21982:2;21953:28;:32::i;:::-;21911:74;;;;22204:53;22235:11;22248:8;22204:30;:53::i;:::-;22199:68;;22259:8;;;;22199:68;22279:38;;;;;;;;2121:25:76;;;-1:-1:-1;;;;;22279:28:41;;;;;2094:18:76;;22279:38:41;;;;;;;;;;;;;;;;;;-1:-1:-1;22279:38:41;;;;;;;;-1:-1:-1;;22279:38:41;;;;;;;;;;;;:::i;:::-;;;22275:623;;;22565:4;-1:-1:-1;;;;;22540:30:41;;;22536:58;;22579:15;;;;;;;;;;;;;;22536:58;22318:285;22275:623;23245:49;23272:11;23285:8;23245:26;:49::i;:::-;21903:1398;;21863:1438;21897:4;;21863:1438;;;;23306:32;:30;:32::i;:::-;23345:70;1647:54:51;23413:1:41;23345:23;:70::i;:::-;23421:55;1398:47:51;23474:1:41;638:109:42;730:6;723:5;716:21;638:109;;:::o;42355:1127:41:-;42512:15;;3057:46:51;4769:12:42;-1:-1:-1;;;;;42764:22:41;;;42760:63;;42795:28;;;;;-1:-1:-1;;;;;194:55:76;;42795:28:41;;;176:74:76;149:18;;42795:28:41;14:242:76;42760:63:41;42829:95;3057:46:51;42916:5:41;-1:-1:-1;;;;;42900:23:41;42829;:95::i;:::-;43051:21;43075:11;:66;;3267:65;43075:66;;;3107:13;43075:66;43195:84;;;;;43051:90;;-1:-1:-1;;;;;;43195:19:41;;;;;:84;;43215:10;;43227:11;;43240:16;;43051:90;;43273:5;;43195:84;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;43172:107;;-1:-1:-1;43172:107:41;-1:-1:-1;3057:46:51;4769:12:42;43369:74:41;43365:112;;43452:25;;;;;-1:-1:-1;;;;;194:55:76;;43452:25:41;;;176:74:76;149:18;;43452:25:41;14:242:76;43365:112:41;42546:936;;42355:1127;;;;;;;;:::o;2941:500:48:-;3060:4;-1:-1:-1;;;;;3042:23:48;;;3038:91;;3075:33;3080:6;3088:10;3100:7;3075:4;:33::i;:::-;3116:7;;3038:91;-1:-1:-1;;;;;3220:20:48;;;;:61;;-1:-1:-1;1398:47:51;4769:12:42;-1:-1:-1;;;;;3244:37:48;:6;-1:-1:-1;;;;;3244:37:48;;;3220:61;3216:100;;;3290:26;;;;;;;;;;;;;;3216:100;3376:60;-1:-1:-1;;;;;3376:31:48;;3408:6;3416:10;3428:7;3376:31;:60::i;19594:178:51:-;19715:51;;;-1:-1:-1;;;;;17630:55:76;;19715:51:51;;;17612:74:76;17702:18;;;17695:34;;;4489:42:51;17745:18:76;;;17738:34;19677:13:51;;17585:18:76;;19715:51:51;;;;;;;;;;;;19705:62;;;;;;19698:69;;19594:178;;;;;:::o;1855:246:42:-;1920:15;1938:18;1945:10;1938:6;:18::i;:::-;1920:36;;1962:13;1978:33;1991:10;2003:7;1978:12;:33::i;:::-;1962:49;;2048:6;2041:5;2034:21;2066:30;2072:10;2084:11;:7;2094:1;2084:11;:::i;23925:4692:41:-;24135:12;24131:4482;;24186:22;24201:6;;24186:14;:22::i;24131:4482::-;1752:4:46;24225:12:41;:42;24221:4392;;24277:23;24293:6;;24277:15;:23::i;24221:4392::-;1908:4:46;24317:12:41;:41;24313:4300;;24368:22;24383:6;;24368:14;:22::i;24313:4300::-;2067:4:46;24407:12:41;:42;24403:4210;;24459:23;24475:6;;24459:15;:23::i;24403:4210::-;4996:4:46;24523:12:41;:41;24519:4094;;24574:23;24590:6;;24574:15;:23::i;24519:4094::-;5216:4:46;24614:12:41;:38;24610:4003;;24662:21;24676:6;;24662:13;:21::i;24610:4003::-;393:4:46;24720:12:41;:30;24716:3897;;24760:25;;;;;:11;;:17;;:25;;24778:6;;;;24760:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6957:300:51;6891:366;;:::o;24716:3897:41:-;577:4:46;24802:12:41;:33;24798:3815;;24845:28;;;;;:11;;:20;;:28;;24866:6;;;;24845:28;;;:::i;24798:3815::-;1156:4:46;24890:12:41;:35;24886:3727;;24935:29;;;;;:11;;:21;;:29;;24957:6;;;;24935:29;;;:::i;24886:3727::-;749:4:46;24981:12:41;:33;24977:3636;;25036:4;-1:-1:-1;;;;;25028:27:41;25024:69;;25064:29;;;;;;;;2121:25:76;;;2094:18;;25064:29:41;1975:177:76;25024:69:41;25101:33;;;;;:11;;:19;;:33;;25121:6;;;;25129:4;;25101:33;;;:::i;24977:3636::-;956:4:46;25151:12:41;:36;25147:3466;;25209:4;-1:-1:-1;;;;;25201:27:41;25197:69;;25237:29;;;;;;;;2121:25:76;;;2094:18;;25237:29:41;1975:177:76;25197:69:41;25274:36;;;;;:11;;:22;;:36;;25297:6;;;;25305:4;;25274:36;;;:::i;25147:3466::-;1425:4:46;25327:12:41;:37;25323:3290;;25374:31;;;;;:11;;:23;;:31;;25398:6;;;;25374:31;;;:::i;25323:3290::-;2572:4:46;25446:12:41;:41;25442:3171;;25497:54;;;;;:13;;:28;;:54;;25526:6;;;;25534:16;;25497:54;;;:::i;25442:3171::-;2735:4:46;25568:12:41;:46;25564:3049;;25624:59;;;;;:13;;:33;;:59;;25658:6;;;;25666:16;;25624:59;;;:::i;25564:3049::-;2903:4:46;25700:12:41;:46;25696:2917;;25756:59;;;;;:13;;:33;;:59;;25790:6;;;;25798:16;;25756:59;;;:::i;25696:2917::-;3060:4:46;25832:12:41;:40;25828:2785;;25882:53;;;;;:13;;:27;;:53;;25910:6;;;;25918:16;;25882:53;;;:::i;25828:2785::-;3262:4:46;25952:12:41;:41;25948:2665;;26003:54;;;;;:13;;:28;;:54;;26032:6;;;;26040:16;;26003:54;;;:::i;25948:2665::-;2239:4:46;26098:12:41;:38;26094:2519;;26146:51;;;;;:12;;:25;;:51;;26172:6;;;;26180:16;;26146:51;;;:::i;26094:2519::-;2405:4:46;26214:12:41;:41;26210:2403;;26265:54;;;;;:12;;:28;;:54;;26294:6;;;;26302:16;;26265:54;;;:::i;26210:2403::-;3437:4:46;26355:12:41;:36;26351:2262;;26413:10;-1:-1:-1;;;;;26405:33:41;26401:75;;26447:29;;;;;;;;2121:25:76;;;2094:18;;26447:29:41;1975:177:76;26401:75:41;26484:59;;;;;:10;;:21;;:59;;26506:6;;;;26514:10;;26526:16;;26484:59;;;:::i;26351:2262::-;3590:4:46;26560:12:41;:38;26556:2057;;26620:10;-1:-1:-1;;;;;26612:33:41;26608:75;;26654:29;;;;;;;;2121:25:76;;;2094:18;;26654:29:41;1975:177:76;26608:75:41;26691:77;;;;;:10;;:23;;:77;;26715:6;;;;26723:10;;26735:14;;26751:16;;26691:77;;;:::i;26556:2057::-;3767:4:46;26803:12:41;:44;26799:1814;;26869:10;-1:-1:-1;;;;;26861:33:41;26857:75;;26903:29;;;;;;;;2121:25:76;;;2094:18;;26903:29:41;1975:177:76;26857:75:41;26940:81;;;;;:9;;:27;;:81;;26968:6;;;;26976:10;;26988:14;;27004:16;;26940:81;;;:::i;26799:1814::-;3944:4:46;27038:12:41;:43;27034:1579;;27091:51;;;;;:9;;:25;;:51;;27117:6;;;;27125:16;;27091:51;;;:::i;27034:1579::-;4464:4:46;27182:12:41;:37;27178:1435;;27229:45;;;;;:13;;:25;;:45;;27255:6;;;;27263:10;;27229:45;;;:::i;27178:1435::-;4636:4:46;27291:12:41;:44;27287:1326;;27357:10;-1:-1:-1;;;;;27349:33:41;27345:75;;27391:29;;;;;;;;2121:25:76;;;2094:18;;27391:29:41;1975:177:76;27345:75:41;27428:51;;;;;:13;;:31;;:51;;27460:6;;;;27468:10;;27428:51;;;:::i;27287:1326::-;4812:4:46;27715:12:41;:31;27711:902;;27768:10;-1:-1:-1;;;;;27760:33:41;27756:75;;27802:29;;;;;;;;2121:25:76;;;2094:18;;27802:29:41;1975:177:76;27756:75:41;27843:7;27839:41;;;27859:21;;;;;;;;2121:25:76;;;2094:18;;27859:21:41;1975:177:76;27839:41:41;27888:56;;;;;:13;;:20;;:56;;27909:6;;;;27917:10;;27929:14;;27888:56;;;:::i;27711:902::-;4116:4:46;28196:12:41;:37;28192:421;;28248:7;28243:42;;28264:21;;;;;;;;2121:25:76;;;2094:18;;28264:21:41;1975:177:76;28243:42:41;28293:64;;;;;:13;;:25;;:64;;28319:6;;;;28327:14;;28343:13;;28293:64;;;:::i;28192:421::-;4274:4:46;28374:12:41;:38;28370:243;;28427:7;28422:42;;28443:21;;;;;;;;2121:25:76;;;2094:18;;28443:21:41;1975:177:76;28422:42:41;28472:74;;;;;:13;;:26;;:74;;28499:6;;;;28507:14;;28523:22;;28472:74;;;:::i;28370:243::-;28574:32;;;;;;;;2121:25:76;;;2094:18;;28574:32:41;1975:177:76;3555:110:42;3614:15;4769:12;;3644:16;4668:123;3892:196;3963:14;3985:13;4001:32;4014:10;4026:6;4001:12;:32::i;:::-;4066:12;;3892:196;-1:-1:-1;;;;3892:196:42:o;3263:104::-;3329:33;3342:10;3354:4;3360:1;3329:12;:33::i;:::-;3263:104;;:::o;1219:204:67:-;1306:37;1320:5;1327:2;1331:5;1338:4;1306:13;:37::i;:::-;1301:116;;1366:40;;;;;-1:-1:-1;;;;;194:55:76;;1366:40:67;;;176:74:76;149:18;;1366:40:67;14:242:76;2883:75:42;2933:20;2939:10;2951:1;2933:5;:20::i;:::-;2883:75;:::o;16408:365:51:-;16465:16;16514:21;1647:54;4769:12:42;16632:37:51;;;16628:90;;;16678:40;;;;;;;;;;;;;;16628:90;16731:37;16748:20;16731:14;:37;:::i;:::-;16724:44;;;;16408:365;:::o;2031:152:67:-;2115:4;2138:38;2152:5;2159:2;2163:5;2170;2138:13;:38::i;:::-;2131:45;;2031:152;;;;;;:::o;15327:137:51:-;15378:15;15408:51;3861;15408:24;:51::i;15666:254::-;15727:19;15748:16;15786:55;3861:51;15834:6;15786:20;:55::i;:::-;15772:69;;15858:57;4188:48;15908:6;15858:24;:57::i;:::-;15847:68;;15666:254;;;:::o;15008:185::-;15094:15;15124:59;15147:35;15160:11;15173:8;15147:12;:35::i;:::-;4769:12:42;;4668:123;15124:59:51;:64;;;15008:185;-1:-1:-1;;;15008:185:51:o;7556:142::-;7630:63;7654:35;7667:11;7680:8;7654:12;:35::i;:::-;7691:1;7630:23;:63::i;7792:150::-;7833:50;3861:51;7833:23;:50::i;:::-;7889:48;4188;7889:23;:48::i;1454:305:48:-;2190:52:51;4769:12:42;-1:-1:-1;;;;;1540:39:48;:6;-1:-1:-1;;;;;1540:39:48;;:98;;;;;1593:45;1631:6;1593:37;:45::i;:::-;1583:7;:55;1540:98;1536:165;;;1655:39;;;;;-1:-1:-1;;;;;194:55:76;;1655:39:48;;;176:74:76;149:18;;1655:39:48;14:242:76;1536:165:48;1706:48;-1:-1:-1;;;;;1706:27:48;;1734:10;1746:7;1706:27;:48::i;1662:232:67:-;1767:47;1785:5;1792:4;1798:2;1802:5;1809:4;1767:17;:47::i;:::-;1762:126;;1837:40;;;;;-1:-1:-1;;;;;194:55:76;;1837:40:67;;;176:74:76;149:18;;1837:40:67;14:242:76;5557:173:42;5637:13;5718:6;5702:10;5691:22;;;;;;2121:25:76;;2109:2;2094:18;;1975:177;5691:22:42;;;;;;;;;;;;;5681:33;;;;;;5673:42;;:51;;;;:::i;29160:2675:41:-;29222:32;29257:39;;;;29268:6;29257:39;:::i;:::-;29222:74;;29400:7;:19;;;:64;;;;-1:-1:-1;29448:16:41;29423;;;;:21;:41;;;;;;;;:::i;:::-;;;29400:64;29396:95;;;29473:18;;;;;;;;;;;;;;29396:95;29499:24;29525:25;29560:78;29582:7;:13;;;29597:7;:15;;;29614:4;29620:7;:17;;;29560:21;:78::i;:::-;29662:13;;:20;29796:19;;;;29498:140;;-1:-1:-1;29498:140:41;;-1:-1:-1;29662:20:41;29644:15;;29796:102;;29843:55;29857:7;:15;;;29874:7;:16;;;29892:5;29843:13;:55::i;:::-;29796:102;;;29818:7;:16;;;:22;;;29796:102;29770:128;;30035:16;30015:9;:37;30011:66;;;30061:16;;;;;;;;;;;;;;30011:66;30083:14;30100:7;:19;;;:65;;30160:4;30100:65;;;1398:47:51;4769:12:42;30122:27:41;30320:16;;;30289:28;30320:16;;;;;;30375:13;;;;;;;;;30083:82;;-1:-1:-1;30320:16:41;30427:1240;30449:7;30444:2;:12;30427:1240;;;30564:18;30595:7;30585:6;:2;30590:1;30585:6;:::i;:::-;:17;:53;;30633:4;30585:53;;;30605:7;:17;;;30585:53;30564:74;-1:-1:-1;30672:4:41;-1:-1:-1;;;;;30650:27:41;;;30646:76;;30679:43;30706:7;30714:6;:2;30719:1;30714:6;:::i;:::-;30706:15;;;;;;;;:::i;:::-;;;;;;;30679:26;:43::i;:::-;30814:35;30852:201;;;;;;;;30888:11;30852:201;;;;30921:16;30852:201;;;;30958:1;30852:201;;;;30978:7;30986:2;30978:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;30852:201:41;;;;;31006:6;-1:-1:-1;;;;;30852:201:41;;;;;31035:9;30852:201;;;30814:239;;31062:15;31079;31106:97;31114:7;:13;;;31128:2;31114:17;;;;;;;;:::i;:::-;;;;;;;31133:11;31145:2;31133:15;;;;;;;;:::i;:::-;;;;;;;31157:9;31169:10;31192:9;31181:21;;;;;;;;:::i;31106:97::-;31061:142;;;;31311:19;31333:11;31345:2;31333:15;;;;;;;;:::i;:::-;;;;;;;:37;;31362:8;31333:37;;;31351:8;31333:37;31311:59;;31397:1;31382:12;:16;31378:48;;;31407:19;;;;;;;;;;;;;;31378:48;31558:13;31559:12;31558:13;:::i;:::-;31538:34;;31655:4;31638:22;;30464:1203;;;;;30458:4;;;;;30427:1240;;;;31751:7;:20;;;31739:9;:32;31735:95;;;31798:20;;;;31780:50;;;;;;;;24551:25:76;;;;24592:18;;;24585:34;;;24524:18;;31780:50:41;24377:248:76;31735:95:41;29216:2619;;;;;;;;29160:2675;;:::o;32411:1826::-;32474:33;32510:40;;;;32521:6;32510:40;:::i;:::-;32474:76;;32558:24;32584:25;32619:78;32641:7;:13;;;32656:7;:15;;;32673:4;32679:7;:17;;;32619:21;:78::i;:::-;32557:140;;;;32703:18;32747:1;32724:7;:13;;;:20;:24;;;;:::i;:::-;32703:45;;32861:4;-1:-1:-1;;;;;32832:34:41;:7;:17;;;-1:-1:-1;;;;;32832:34:41;;32828:91;;32868:51;32895:7;32903:14;:10;32916:1;32903:14;:::i;32868:51::-;33038:16;33010:7;:17;;;:45;33006:74;;;33064:16;;;;;;;;;;;;;;33006:74;33190:14;33207:7;:19;;;:65;;33267:4;33207:65;;;1398:47:51;4769:12:42;33229:27:41;33190:82;;33374:7;:19;;;33369:69;;33395:43;33422:7;:15;;;33395:26;:43::i;:::-;33537:35;33575:207;;;;;;;;33609:7;:13;;;33575:207;;;;33642:11;33575:207;;;;33672:10;33575:207;;;;33699:7;:15;;;-1:-1:-1;;;;;33575:207:41;;;;;33729:6;-1:-1:-1;;;;;33575:207:41;;;;;33756:7;:19;;;33575:207;;;33537:245;;33789:15;33806;33825:165;33840:7;:13;;;33854:10;33840:25;;;;;;;;:::i;:::-;;;;;;;33873:11;33885:10;33873:23;;;;;;;;:::i;:::-;;;;;;;33912:7;:17;;;33904:26;;;:::i;:::-;33938:7;:17;;;33974:9;33963:21;;;;;;;;:::i;33825:165::-;33788:202;;;;34085:19;34107:11;34119:10;34107:23;;;;;;;;:::i;:::-;;;;;;;:45;;34144:8;34107:45;;;34133:8;34107:45;34085:67;;34188:7;:17;;;34171:12;34170:13;;;:::i;:::-;34162:43;34158:74;;34214:18;;;;;;;;;;;;;;34158:74;32468:1769;;;;;;;;;32411:1826;;:::o;34956:2859::-;35018:32;35053:39;;;;35064:6;35053:39;:::i;:::-;35018:74;;35196:7;:19;;;:64;;;;-1:-1:-1;35244:16:41;35219;;;;:21;:41;;;;;;;;:::i;:::-;;;35196:64;35192:95;;;35269:18;;;;;;;;;;;;;;35192:95;35295:24;35321:25;35356:79;35378:7;:13;;;35393:7;:15;;;35410:5;35417:7;:17;;;35356:21;:79::i;:::-;35294:141;;;;35515:15;35533:7;:13;;;:20;35515:38;;35559:17;35579:7;35587;35579:16;;;;;;;;:::i;:::-;;;;;;;35559:36;;35634:4;-1:-1:-1;;;;;35605:34:41;:7;:17;;;-1:-1:-1;;;;;35605:34:41;;35601:77;;35641:37;35668:9;35641:26;:37::i;:::-;35766:17;35792:7;:19;;;:102;;35839:55;35853:7;:15;;;35870:7;:16;;;35888:5;35839:13;:55::i;:::-;35792:102;;;35814:7;:16;;;:22;;;35792:102;35766:128;;35900:137;35920:7;:15;;;35937:7;:19;;;:65;;35997:4;35937:65;;;1398:47:51;4769:12:42;35959:27:41;36004:13;;:16;;:13;;:16;;;;:::i;:::-;;;;;;;36022:9;35900:12;:137::i;:::-;36044:22;;36109:1449;36131:7;36126:2;:12;36109:1449;;;36154:23;36305:17;36324;36352:7;:13;;;36366:2;36352:17;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;36346:36:41;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;36304:80;;;;;36394:18;36415:11;36427:2;36415:15;;;;;;;;:::i;:::-;;;;;;;:39;;36445:9;36415:39;;;36433:9;36415:39;36394:60;;36464:20;36494:7;36502:2;36494:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;36487:29:41;;36517:7;:13;;;36531:2;36517:17;;;;;;;;:::i;:::-;;;;;;;36487:48;;;;;;;;;;;;;;-1:-1:-1;;;;;194:55:76;;;;176:74;;164:2;149:18;;14:242;36487:48:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;36464:71;;36564:10;36549:12;:25;36545:72;;;36599:13;;:17;;36613:2;;36599:17;;;;;;:::i;:::-;;;;;;;36583:34;;;;;;;;;;-1:-1:-1;;;;;194:55:76;;;;176:74;;164:2;149:18;;14:242;36545:72:41;36645:25;36660:10;36645:12;:25;:::i;:::-;36627:43;;36185:494;;;;36805:18;36832:7;:13;;;36846:2;36832:17;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;36826:49:41;;36876:15;36893:7;36901:2;36893:11;;;;;;;;:::i;:::-;;;;;;;36826:79;;;;;;;;;;;;;;;26510:25:76;;;-1:-1:-1;;;;;26571:55:76;26566:2;26551:18;;26544:83;26498:2;26483:18;;26336:297;36826:79:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;36805:100;-1:-1:-1;36913:18:41;36952:7;36943:6;:2;36948:1;36943:6;:::i;:::-;:16;36939:538;;;36984:13;;36998:6;:2;37003:1;36998:6;:::i;:::-;36984:21;;;;;;;;:::i;:::-;;;;;;;36971:34;;36939:538;;;37167:7;:20;;;37154:10;:33;37150:97;;;37214:20;;;;37196:51;;;;;;;;24551:25:76;;;;24592:18;;;24585:34;;;24524:18;;37196:51:41;24377:248:76;37150:97:41;-1:-1:-1;37270:17:41;;;;37429:39;;;;;-1:-1:-1;;;;;194:55:76;;;37429:39:41;;;176:74:76;37429:27:41;;;;;149:18:76;;37429:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;37412:56;;36939:538;37484:67;37492:7;:13;;;37506:2;37492:17;;;;;;;;:::i;:::-;;;;;;;37511:11;37523:2;37511:15;;;;;;;;:::i;:::-;;;;;;;37528:10;37540;37484:7;:67::i;:::-;36146:1412;;;36140:4;;;;;36109:1449;;;-1:-1:-1;37674:17:41;;;;37646:46;;;;;-1:-1:-1;;;;;194:55:76;;;37646:46:41;;;176:74:76;37626:17:41;;37695:14;;37646:27;;;;;;149:18:76;;37646:46:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:63;;;;:::i;:::-;37626:83;;37731:7;:20;;;37719:9;:32;37715:95;;;37778:20;;;;37760:50;;;;;;;;24551:25:76;;;;24592:18;;;24585:34;;;24524:18;;37760:50:41;24377:248:76;38567:2437:41;38630:33;38666:40;;;;38677:6;38666:40;:::i;:::-;38630:76;;38714:24;38740:25;38775:79;38797:7;:13;;;38812:7;:15;;;38829:5;38836:7;:17;;;38775:21;:79::i;:::-;38713:141;;;;38860:15;38878:7;:13;;;:20;38860:38;;38904:17;38924:7;38932;38924:16;;;;;;;;:::i;:::-;;;;;;;38904:36;;39053:4;-1:-1:-1;;;;;39024:34:41;:7;:17;;;-1:-1:-1;;;;;39024:34:41;;39020:77;;39060:37;39087:9;39060:26;:37::i;:::-;39176:25;39218:11;:7;39228:1;39218:11;:::i;:::-;39204:26;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;39204:26:41;;39176:54;;39256:7;:17;;;39236:8;39245:7;39236:17;;;;;;;;:::i;:::-;;;;;;;;;;:37;39297:7;39279:257;39306:6;;39279:257;;39323:4;;;:::i;:::-;;;39452:7;:13;;;39466:2;39452:17;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;39446:48:41;;39495:8;39504:2;39509:1;39504:6;;;;:::i;:::-;39495:16;;;;;;;;:::i;:::-;;;;;;;39513:7;39521:2;39526:1;39521:6;;;;:::i;:::-;39513:15;;;;;;;;:::i;:::-;;;;;;;39446:83;;;;;;;;;;;;;;;26510:25:76;;;-1:-1:-1;;;;;26571:55:76;26566:2;26551:18;;26544:83;26498:2;26483:18;;26336:297;39446:83:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;39431:8;39440:2;39431:12;;;;;;;;:::i;:::-;;;;;;:98;;;;;39279:257;;;;39637:7;:19;;;39623:8;39632:1;39623:11;;;;;;;;:::i;:::-;;;;;;;:33;39619:64;;;39665:18;;;;;;;;;;;;;;39619:64;39758:14;39775:7;:19;;;:65;;39835:4;39775:65;;;1398:47:51;4769:12:42;39797:27:41;39758:82;;39942:7;:19;;;39937:69;;39963:43;39990:7;:15;;;39963:26;:43::i;:::-;40012:68;40025:7;:15;;;40042:6;40050:7;:13;;;40064:1;40050:16;;;;;;;;:::i;:::-;;;;;;;40068:8;40077:1;40068:11;;;;;;;;:::i;:::-;;;;;;;40012:12;:68::i;:::-;40087:22;;40152:587;40174:7;40169:2;:12;40152:587;;;40315:18;40354:7;40345:6;:2;40350:1;40345:6;:::i;:::-;:16;40341:311;;;40386:13;;40400:6;:2;40405:1;40400:6;:::i;:::-;40386:21;;;;;;;;:::i;:::-;;;;;;;40373:34;;40341:311;;;-1:-1:-1;40445:17:41;;;;40604:39;;;;;-1:-1:-1;;;;;194:55:76;;;40604:39:41;;;176:74:76;40604:27:41;;;;;149:18:76;;40604:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;40587:56;;40341:311;40659:73;40667:7;:13;;;40681:2;40667:17;;;;;;;;:::i;:::-;;;;;;;40686:11;40698:2;40686:15;;;;;;;;:::i;:::-;;;;;;;40703:8;40712:2;40717:1;40712:6;;;;:::i;:::-;40703:16;;;;;;;;:::i;:::-;;;;;;;40721:10;40659:7;:73::i;:::-;-1:-1:-1;40183:4:41;;40152:587;;;-1:-1:-1;40869:17:41;;;;40841:46;;;;;-1:-1:-1;;;;;194:55:76;;;40841:46:41;;;176:74:76;40821:17:41;;40890:14;;40841:27;;;;;;149:18:76;;40841:46:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:63;;;;:::i;:::-;40821:83;;40926:7;:17;;;40914:9;:29;40910:89;;;40970:7;:17;;;40989:9;40952:47;;;;;;;;;;;24551:25:76;;;24607:2;24592:18;;24585:34;24539:2;24524:18;;24377:248;43725:303:41;43797:25;;43853:36;;;;43864:6;43853:36;:::i;:::-;43899:57;;;;;43796:93;;-1:-1:-1;43796:93:41;-1:-1:-1;43899:4:41;;:12;;:57;;43796:93;;;;-1:-1:-1;;43938:17:41;43899:57;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;43895:129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;44001:16;44009:7;44001;:16::i;:::-;43964:60;43895:129;;47382:558;47457:14;;;47512:47;;;;47523:6;47512:47;:::i;:::-;47456:103;;-1:-1:-1;47456:103:41;-1:-1:-1;47456:103:41;-1:-1:-1;47565:16:41;-1:-1:-1;;;;;47591:20:41;;47587:281;;-1:-1:-1;;;;;47632:23:41;;47650:4;47632:23;:83;;47701:6;-1:-1:-1;;;;;47701:14:41;;47632:83;;;47658:40;:38;:40::i;:::-;47621:94;;47587:281;;;-1:-1:-1;;;;;47755:23:41;;47773:4;47755:23;:106;;47829:32;;;;;-1:-1:-1;;;;;194:55:76;;;47829:32:41;;;176:74:76;47829:24:41;;;;;149:18:76;;47829:32:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;47755:106;;;47781:45;47819:6;47781:37;:45::i;:::-;47736:125;;47587:281;47888:11;47877:8;:22;47873:62;;;47908:27;;;;;-1:-1:-1;;;;;194:55:76;;47908:27:41;;;176:74:76;149:18;;47908:27:41;14:242:76;1021:207:42;1138:4;1132;1125:18;1163:10;1157:4;1150:24;1211:6;1204:4;1198;1188:21;1181:37;1021:207;;;:::o;8373:1244:67:-;8600:4;8594:11;8509:24;8467:12;8618:22;;;-1:-1:-1;;;;;8666:24:67;;8660:4;8653:38;8711:4;8704:19;;;8467:12;8787:4;8467:12;8775:4;8467:12;;8759:5;8752;8747:45;8736:56;;9004:1;8997:4;8991:11;8988:18;8979:7;8975:32;8965:606;;9136:6;9126:7;9119:15;9115:28;9112:165;;;9192:16;9186:4;9181:3;9166:43;9242:16;9237:3;9230:29;9112:165;9553:1;9545:5;9533:18;9530:25;9511:16;9504:24;9500:56;9491:7;9487:70;9476:81;;8965:606;9591:4;9584:17;-1:-1:-1;8373:1244:67;;-1:-1:-1;;;;8373:1244:67:o;17481:236:51:-;17551:16;2190:52;4769:12:42;-1:-1:-1;;;;;17579:23:51;:6;-1:-1:-1;;;;;17579:23:51;;17575:81;;2808:57;4769:12:42;17611:24:51;:22;:24::i;:::-;:45;;;;:::i;17575:81::-;17673:39;;;;;17706:4;17673:39;;;176:74:76;-1:-1:-1;;;;;17673:24:51;;;;;149:18:76;;17673:39:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;10165:1393:67:-;10460:4;10454:11;10365:28;10323:12;10478:22;;;-1:-1:-1;;;;;10526:26:67;;;10520:4;10513:40;10579:24;;10573:4;10566:38;10624:4;10617:19;;;10323:12;10700:4;10323:12;10688:4;10323:12;;10672:5;10665;10660:45;10649:56;;10917:1;10910:4;10904:11;10901:18;10892:7;10888:32;10878:606;;11049:6;11039:7;11032:15;11028:28;11025:165;;;11105:16;11099:4;11094:3;11079:43;11155:16;11150:3;11143:29;11025:165;11466:1;11458:5;11446:18;11443:25;11424:16;11417:24;11413:56;11404:7;11400:70;11389:81;;10878:606;11504:4;11497:17;-1:-1:-1;11540:1:67;11534:4;11527:15;10165:1393;;-1:-1:-1;;;;;10165:1393:67:o;44575:1748:41:-;44727:24;;-1:-1:-1;;;;;44790:24:41;;44786:55;;44823:18;;;;;;;;;;;;;;44786:55;44865:13;;44847:15;44888:12;;;44884:38;;44909:13;;;;;;;;;;;;;;44884:38;44952:11;:7;44962:1;44952:11;:::i;:::-;44938:26;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;44938:26:41;;44928:36;;44995:7;44984:19;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;44984:19:41;;44970:33;;45022:8;45009:7;45017:1;45009:10;;;;;;;;:::i;:::-;;;;;;:21;-1:-1:-1;;;;;45009:21:41;;;-1:-1:-1;;;;;45009:21:41;;;;;45042:10;45037:1282;45059:7;45054:2;:12;45037:1282;;;45082:13;45098:6;45105:2;45098:10;;;;;;;;:::i;:::-;;;;;;;;;;;45252:39;;;;;-1:-1:-1;;;;;194:55:76;;;45252:39:41;;;176:74:76;45098:10:41;;-1:-1:-1;45233:16:41;;45252;:32;;;;149:18:76;;45252:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45233:58;-1:-1:-1;;;;;;45303:22:41;;45299:53;;45334:18;;;;;-1:-1:-1;;;;;194:55:76;;45334:18:41;;;176:74:76;149:18;;45334::41;14:242:76;45299:53:41;45365:36;;;;;-1:-1:-1;;;;;194:55:76;;;45365:36:41;;;176:74:76;45365:29:41;;;;;149:18:76;;45365:36:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45360:68;;45410:18;;;;;-1:-1:-1;;;;;194:55:76;;45410:18:41;;;176:74:76;149:18;;45410::41;14:242:76;45360:68:41;45532:17;45558:5;-1:-1:-1;;;;;45552:22:41;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45532:44;;45641:8;45637:218;;;45678:13;45665:9;:26;45661:57;;45700:18;;;;;-1:-1:-1;;;;;194:55:76;;45700:18:41;;;176:74:76;149:18;;45700::41;14:242:76;45661:57:41;45637:218;;;45750:22;45737:9;:35;;:72;;;;;45789:20;45776:9;:33;;45737:72;45733:122;;;45828:18;;;;;-1:-1:-1;;;;;194:55:76;;45828:18:41;;;176:74:76;149:18;;45828::41;14:242:76;45733:122:41;45929:15;45946;45972:5;-1:-1:-1;;;;;45966:19:41;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45995:5;-1:-1:-1;;;;;45989:19:41;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45928:83;;;;46019:18;46055:7;-1:-1:-1;;;;;46040:22:41;:7;46048:2;46040:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;46040:22:41;;46019:43;;46075:13;46074:14;:40;;;;;46107:7;-1:-1:-1;;;;;46092:22:41;:7;46100:2;46092:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;46092:22:41;;;46074:40;46070:66;;;46123:13;;;;;;;;;;;;;;46070:66;46162:13;46144:11;46156:2;46144:15;;;;;;;;:::i;:::-;:31;;;:15;;;;;;;;;;;:31;46279:13;:33;;46305:7;46279:33;;;46295:7;46279:33;46261:7;46269:6;:2;46274:1;46269:6;:::i;:::-;46261:15;;;;;;;;:::i;:::-;;;;;;:51;-1:-1:-1;;;;;46261:51:41;;;-1:-1:-1;;;;;46261:51:41;;;;;45074:1245;;;;;;45068:4;;;;;45037:1282;;;;44780:1543;44575:1748;;;;;;;:::o;4295:550:48:-;4418:15;4445:12;4441:400;;;4486:28;4471:11;;:43;;;;;;;;:::i;:::-;;4467:86;;4523:30;;;;;;;;;;;;;;4467:86;4586:39;;;;;4619:4;4586:39;;;176:74:76;4561:22:48;;-1:-1:-1;;;;;4586:24:48;;;;;149:18:76;;4586:39:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4561:64;;4633:26;4638:6;4646;:12;;;4633:4;:26::i;:::-;4677:39;;;;;4710:4;4677:39;;;176:74:76;4719:14:48;;-1:-1:-1;;;;;4677:24:48;;;;;149:18:76;;4677:39:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:56;;;;:::i;:::-;4667:66;;4459:281;4441:400;;;4764:28;4777:6;4785;4764:12;:28::i;:::-;4754:38;;4800:34;4827:6;6389:119:51;6440:63;3533:48;3295:50;6496:6;6440:23;:63::i;41365:285:41:-;41471:19;41492;41515:11;:65;;41557:10;41577:1;41515:65;;;41538:1;41542:10;41515:65;41586:59;;;;;;;;29765:25:76;;;29806:18;;;29799:34;;;-1:-1:-1;;;;;29869:55:76;;;29849:18;;;29842:83;29961:3;29941:18;;;29934:31;-1:-1:-1;29981:19:76;;;29974:30;41470:110:41;;-1:-1:-1;41470:110:41;;-1:-1:-1;41586:17:41;;;;;;30021:19:76;;41586:59:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48611:143;48735:7;48729:14;48722:4;48713:7;48709:18;48702:42;2188:245:48;2250:34;2277:6;2250:26;:34::i;:::-;2344:84;-1:-1:-1;;;;;2344:31:48;;1398:47:51;4769:12:42;2413:4:48;2420:7;2344:31;:84::i;5350:225::-;5463:15;5493:77;5508:6;5516:45;5554:6;5516:37;:45::i;:::-;5563:6;5493:14;:77::i;1481:202:42:-;5140:14;5179:18;;;5211:4;5204:24;;;5267:4;5251:21;;5245:28;1569:34;1565:47;;1481:202;;;:::o;1565:47::-;1617:33;1630:10;1642:4;1648:1;1617:12;:33::i;:::-;1656:22;1661:10;1673:4;1656;:22::i;5891:600:48:-;6028:15;;6055:11;;:43;;;;;;;;:::i;:::-;;6051:184;;6127:8;6112:6;:12;;;:23;6108:94;;;6154:39;;;;;-1:-1:-1;;;;;194:55:76;;6154:39:48;;;176:74:76;149:18;;6154:39:48;14:242:76;6108:94:48;-1:-1:-1;6216:12:48;;;;6209:19;;6051:184;171:9:40;6359:6:48;:12;;;:23;6355:73;;;6415:6;:12;;;6391:37;;;;;;;;;2121:25:76;;2109:2;2094:18;;1975:177;6355:73:48;6441:45;6453:8;6463:6;:12;;;171:9:40;7378:14:74;7429:12;7443:11;7458:12;7465:1;7468;7458:6;:12::i;:::-;7428:42;;;;7552:4;7560:1;7552:9;7548:365;;7887:11;7881:3;:17;;;;;:::i;:::-;;7874:24;;;;;;7548:365;8038:4;8023:11;:19;8019:142;;8062:84;5328:5;8082:16;;5327:36;940:4:72;5322:42:74;8062:11;:84::i;:::-;8413:17;8564:11;8561:1;8558;8551:25;8956:12;8986:15;;;8971:31;;9121:22;;;;;9854:1;9835;:15;;9834:21;;10087;;;10083:25;;10072:36;10157:21;;;10153:25;;10142:36;10229:21;;;10225:25;;10214:36;10300:21;;;10296:25;;10285:36;10373:21;;;10369:25;;10358:36;10447:21;;;10443:25;;;10432:36;9363:12;;;;9359:23;;;9384:1;9355:31;8676:18;;;8666:29;;;9470:11;;;;8719:19;;;;9214:14;;;;9463:18;;;;10922:13;;-1:-1:-1;;7296:3683:74;;;;;:::o;1027:550::-;1088:12;;-1:-1:-1;;1471:1:74;1468;1461:20;1501:9;;;;1549:11;;;1535:12;;;;1531:30;;;;;1027:550;-1:-1:-1;;1027:550:74:o;1776:194:72:-;1881:10;1875:4;1868:24;1918:4;1912;1905:18;1949:4;1943;1936:18;261:154:76;-1:-1:-1;;;;;340:5:76;336:54;329:5;326:65;316:93;;405:1;402;395:12;420:134;488:20;;517:31;488:20;517:31;:::i;:::-;420:134;;;:::o;559:347::-;610:8;620:6;674:3;667:4;659:6;655:17;651:27;641:55;;692:1;689;682:12;641:55;-1:-1:-1;715:20:76;;758:18;747:30;;744:50;;;790:1;787;780:12;744:50;827:4;819:6;815:17;803:29;;879:3;872:4;863:6;855;851:19;847:30;844:39;841:59;;;896:1;893;886:12;841:59;559:347;;;;;:::o;911:806::-;1008:6;1016;1024;1032;1040;1093:3;1081:9;1072:7;1068:23;1064:33;1061:53;;;1110:1;1107;1100:12;1061:53;1149:9;1136:23;1168:31;1193:5;1168:31;:::i;:::-;1218:5;-1:-1:-1;1275:2:76;1260:18;;1247:32;1288:33;1247:32;1288:33;:::i;:::-;1340:7;-1:-1:-1;1420:2:76;1405:18;;1392:32;;-1:-1:-1;1501:2:76;1486:18;;1473:32;1528:18;1517:30;;1514:50;;;1560:1;1557;1550:12;1514:50;1599:58;1649:7;1640:6;1629:9;1625:22;1599:58;:::i;:::-;911:806;;;;-1:-1:-1;911:806:76;;-1:-1:-1;1676:8:76;;1573:84;911:806;-1:-1:-1;;;911:806:76:o;2410:1038::-;2536:6;2544;2552;2560;2568;2621:2;2609:9;2600:7;2596:23;2592:32;2589:52;;;2637:1;2634;2627:12;2589:52;2677:9;2664:23;2710:18;2702:6;2699:30;2696:50;;;2742:1;2739;2732:12;2696:50;2781:58;2831:7;2822:6;2811:9;2807:22;2781:58;:::i;:::-;2858:8;;-1:-1:-1;2755:84:76;-1:-1:-1;;2946:2:76;2931:18;;2918:32;2975:18;2962:32;;2959:52;;;3007:1;3004;2997:12;2959:52;3030:24;;3085:4;3077:13;;3073:27;-1:-1:-1;3063:55:76;;3114:1;3111;3104:12;3063:55;3154:2;3141:16;3180:18;3172:6;3169:30;3166:50;;;3212:1;3209;3202:12;3166:50;3265:7;3260:2;3250:6;3247:1;3243:14;3239:2;3235:23;3231:32;3228:45;3225:65;;;3286:1;3283;3276:12;3225:65;2410:1038;;;;-1:-1:-1;3317:2:76;3309:11;;3414:2;3399:18;3386:32;;2410:1038;-1:-1:-1;;;2410:1038:76:o;5284:641::-;5370:6;5378;5386;5394;5447:2;5435:9;5426:7;5422:23;5418:32;5415:52;;;5463:1;5460;5453:12;5415:52;5508:23;;;-1:-1:-1;5628:2:76;5613:18;;5600:32;;-1:-1:-1;5709:2:76;5694:18;;5681:32;5736:18;5725:30;;5722:50;;;5768:1;5765;5758:12;5722:50;5807:58;5857:7;5848:6;5837:9;5833:22;5807:58;:::i;:::-;5284:641;;;;-1:-1:-1;5884:8:76;-1:-1:-1;;;;5284:641:76:o;5930:184::-;5982:77;5979:1;5972:88;6079:4;6076:1;6069:15;6103:4;6100:1;6093:15;6119:253;6191:2;6185:9;6233:4;6221:17;;6268:18;6253:34;;6289:22;;;6250:62;6247:88;;;6315:18;;:::i;:::-;6351:2;6344:22;6119:253;:::o;6377:251::-;6449:2;6443:9;;;6479:15;;6524:18;6509:34;;6545:22;;;6506:62;6503:88;;;6571:18;;:::i;6633:334::-;6704:2;6698:9;6760:2;6750:13;;-1:-1:-1;;6746:86:76;6734:99;;6863:18;6848:34;;6884:22;;;6845:62;6842:88;;;6910:18;;:::i;:::-;6946:2;6939:22;6633:334;;-1:-1:-1;6633:334:76:o;6972:183::-;7032:4;7065:18;7057:6;7054:30;7051:56;;;7087:18;;:::i;:::-;-1:-1:-1;7132:1:76;7128:14;7144:4;7124:25;;6972:183::o;7160:744::-;7214:5;7267:3;7260:4;7252:6;7248:17;7244:27;7234:55;;7285:1;7282;7275:12;7234:55;7325:6;7312:20;7352:64;7368:47;7408:6;7368:47;:::i;:::-;7352:64;:::i;:::-;7440:3;7464:6;7459:3;7452:19;7496:4;7491:3;7487:14;7480:21;;7557:4;7547:6;7544:1;7540:14;7532:6;7528:27;7524:38;7510:52;;7585:3;7577:6;7574:15;7571:35;;;7602:1;7599;7592:12;7571:35;7638:4;7630:6;7626:17;7652:221;7668:6;7663:3;7660:15;7652:221;;;7750:3;7737:17;7767:31;7792:5;7767:31;:::i;:::-;7811:18;;7858:4;7849:14;;;;7685;7652:221;;;-1:-1:-1;7891:7:76;7160:744;-1:-1:-1;;;;;7160:744:76:o;7909:118::-;7995:5;7988:13;7981:21;7974:5;7971:32;7961:60;;8017:1;8014;8007:12;8032:128;8097:20;;8126:28;8097:20;8126:28;:::i;8165:738::-;8216:5;8269:3;8262:4;8254:6;8250:17;8246:27;8236:55;;8287:1;8284;8277:12;8236:55;8327:6;8314:20;8354:64;8370:47;8410:6;8370:47;:::i;8354:64::-;8442:3;8466:6;8461:3;8454:19;8498:4;8493:3;8489:14;8482:21;;8559:4;8549:6;8546:1;8542:14;8534:6;8530:27;8526:38;8512:52;;8587:3;8579:6;8576:15;8573:35;;;8604:1;8601;8594:12;8573:35;8640:4;8632:6;8628:17;8654:218;8670:6;8665:3;8662:15;8654:218;;;8752:3;8739:17;8769:28;8791:5;8769:28;:::i;:::-;8810:18;;8857:4;8848:14;;;;8687;8654:218;;8908:1175;9003:6;9056:2;9044:9;9035:7;9031:23;9027:32;9024:52;;;9072:1;9069;9062:12;9024:52;9112:9;9099:23;9145:18;9137:6;9134:30;9131:50;;;9177:1;9174;9167:12;9131:50;9200:22;;9256:4;9238:16;;;9234:27;9231:47;;;9274:1;9271;9264:12;9231:47;9300:22;;:::i;:::-;9360:2;9347:16;9388:18;9378:8;9375:32;9372:52;;;9420:1;9417;9410:12;9372:52;9447:56;9495:7;9484:8;9480:2;9476:17;9447:56;:::i;:::-;9440:5;9433:71;;9550:2;9546;9542:11;9529:25;9579:18;9569:8;9566:32;9563:52;;;9611:1;9608;9601:12;9563:52;9647:53;9692:7;9681:8;9677:2;9673:17;9647:53;:::i;:::-;9642:2;9631:14;;9624:77;-1:-1:-1;9767:2:76;9759:11;;;9746:25;9787:14;;;9780:31;9843;9870:2;9862:11;;9843:31;:::i;:::-;9838:2;9831:5;9827:14;9820:55;9908:32;9935:3;9931:2;9927:12;9908:32;:::i;:::-;9902:3;9891:15;;9884:57;10007:3;9999:12;;;9986:26;10028:15;;;10021:32;;;;9895:5;8908:1175;-1:-1:-1;;;8908:1175:76:o;10088:184::-;10140:77;10137:1;10130:88;10237:4;10234:1;10227:15;10261:4;10258:1;10251:15;10277:196;10316:3;10344:5;10334:39;;10353:18;;:::i;:::-;-1:-1:-1;;;10389:78:76;;10277:196::o;10478:184::-;10530:77;10527:1;10520:88;10627:4;10624:1;10617:15;10651:4;10648:1;10641:15;10667:191;10702:3;10733:66;10726:5;10723:77;10720:103;;10803:18;;:::i;:::-;-1:-1:-1;10843:1:76;10839:13;;10667:191::o;10863:433::-;10913:3;10951:5;10945:12;10978:6;10973:3;10966:19;11010:4;11005:3;11001:14;10994:21;;11049:4;11042:5;11038:16;11072:1;11082:189;11096:6;11093:1;11090:13;11082:189;;;11171:13;;11164:21;11157:29;11145:42;;11216:4;11207:14;;;;11244:17;;;;11118:1;11111:9;11082:189;;;-1:-1:-1;11287:3:76;;10863:433;-1:-1:-1;;;;10863:433:76:o;11301:1389::-;11502:2;11484:21;;;11576:13;;11625:4;11605:18;;;11598:32;11679:19;;11543:3;11528:19;;11707:22;;;11465:4;;11787:21;;;;;11465:4;;11760:3;11745:19;;;11836:218;11850:6;11847:1;11844:13;11836:218;;;-1:-1:-1;;;;;11921:6:76;11915:13;11911:62;11906:3;11899:75;12003:2;11998:3;11994:12;11987:19;;12041:2;12033:6;12029:15;12019:25;;11872:1;11869;11865:9;11860:14;;11836:218;;;11840:3;12103:2;12095:6;12091:15;12085:22;12063:44;;-1:-1:-1;;12156:9:76;12151:3;12147:19;12143:92;12138:2;12127:9;12123:18;12116:120;12259:46;12301:3;12285:14;12259:46;:::i;:::-;12245:60;;;;12359:2;12351:6;12347:15;12341:22;12336:2;12325:9;12321:18;12314:50;12413:2;12405:6;12401:15;12395:22;12426:55;12476:3;12465:9;12461:19;12445:14;-1:-1:-1;;;;;4470:54:76;4458:67;;4404:127;12426:55;-1:-1:-1;12530:3:76;12518:16;;12512:23;-1:-1:-1;;;;;4470:54:76;;12594:3;12579:19;;4458:67;12544:55;12655:3;12647:6;12643:16;12637:23;12630:4;12619:9;12615:20;12608:53;12678:6;12670:14;;;11301:1389;;;;:::o;12695:580::-;12772:4;12778:6;12838:11;12825:25;12928:66;12917:8;12901:14;12897:29;12893:102;12873:18;12869:127;12859:155;;13010:1;13007;13000:12;12859:155;13037:33;;13089:20;;;-1:-1:-1;13132:18:76;13121:30;;13118:50;;;13164:1;13161;13154:12;13118:50;13197:4;13185:17;;-1:-1:-1;13228:14:76;13224:27;;;13214:38;;13211:58;;;13265:1;13262;13255:12;13537:347;13578:3;13616:5;13610:12;13643:6;13638:3;13631:19;13699:6;13692:4;13685:5;13681:16;13674:4;13669:3;13665:14;13659:47;13751:1;13744:4;13735:6;13730:3;13726:16;13722:27;13715:38;13873:4;-1:-1:-1;;13798:2:76;13790:6;13786:15;13782:88;13777:3;13773:98;13769:109;13762:116;;;13537:347;;;;:::o;13889:1031::-;14160:2;14149:9;14142:21;14123:4;14186:44;14226:2;14215:9;14211:18;14203:6;14186:44;:::i;:::-;14278:9;14270:6;14266:22;14261:2;14250:9;14246:18;14239:50;14309:6;14344;14338:13;14375:6;14367;14360:22;14410:2;14402:6;14398:15;14391:22;;14469:2;14459:6;14456:1;14452:14;14444:6;14440:27;14436:36;14507:2;14499:6;14495:15;14528:1;14538:310;14552:6;14549:1;14546:13;14538:310;;;-1:-1:-1;;14629:6:76;14621;14617:19;14613:92;14608:3;14601:105;14729:39;14761:6;14752;14746:13;14729:39;:::i;:::-;14803:2;14826:12;;;;14719:49;;-1:-1:-1;14791:15:76;;;;;14574:1;14567:9;14538:310;;;14542:3;;14865:6;14857:14;;;;;;14907:6;14902:2;14891:9;14887:18;14880:34;13889:1031;;;;;;:::o;14925:128::-;14992:9;;;15013:11;;;15010:37;;;15027:18;;:::i;15058:230::-;15128:6;15181:2;15169:9;15160:7;15156:23;15152:32;15149:52;;;15197:1;15194;15187:12;15149:52;-1:-1:-1;15242:16:76;;15058:230;-1:-1:-1;15058:230:76:o;15503:217::-;15650:2;15639:9;15632:21;15613:4;15670:44;15710:2;15699:9;15695:18;15687:6;15670:44;:::i;15725:184::-;15777:77;15774:1;15767:88;15874:4;15871:1;15864:15;15898:4;15895:1;15888:15;15914:274;15954:1;15980;15970:189;;16015:77;16012:1;16005:88;16116:4;16113:1;16106:15;16144:4;16141:1;16134:15;15970:189;-1:-1:-1;16173:9:76;;15914:274::o;16193:251::-;16263:6;16316:2;16304:9;16295:7;16291:23;16287:32;16284:52;;;16332:1;16329;16322:12;16284:52;16364:9;16358:16;16383:31;16408:5;16383:31;:::i;16449:610::-;-1:-1:-1;;;;;16704:6:76;16700:55;16689:9;16682:74;16806:6;16799:14;16792:22;16787:2;16776:9;16772:18;16765:50;16851:6;16846:2;16835:9;16831:18;16824:34;-1:-1:-1;;;;;16898:6:76;16894:55;16889:2;16878:9;16874:18;16867:83;16987:3;16981;16970:9;16966:19;16959:32;16663:4;17008:45;17048:3;17037:9;17033:19;17025:6;17008:45;:::i;:::-;17000:53;16449:610;-1:-1:-1;;;;;;;16449:610:76:o;17064:341::-;17141:6;17149;17202:2;17190:9;17181:7;17177:23;17173:32;17170:52;;;17218:1;17215;17208:12;17170:52;-1:-1:-1;;17263:16:76;;17369:2;17354:18;;;17348:25;17263:16;;17348:25;;-1:-1:-1;17064:341:76:o;17783:125::-;17848:9;;;17869:10;;;17866:36;;;17882:18;;:::i;17913:325::-;18001:6;17996:3;17989:19;18053:6;18046:5;18039:4;18034:3;18030:14;18017:43;;18105:1;18098:4;18089:6;18084:3;18080:16;18076:27;18069:38;17971:3;18227:4;-1:-1:-1;;18152:2:76;18144:6;18140:15;18136:88;18131:3;18127:98;18123:109;18116:116;;17913:325;;;;:::o;18243:252::-;18408:2;18397:9;18390:21;18371:4;18428:61;18485:2;18474:9;18470:18;18462:6;18454;18428:61;:::i;18500:386::-;18707:2;18696:9;18689:21;18670:4;18727:61;18784:2;18773:9;18769:18;18761:6;18753;18727:61;:::i;:::-;18719:69;;-1:-1:-1;;;;;18828:6:76;18824:55;18819:2;18808:9;18804:18;18797:83;18500:386;;;;;;:::o;19293:536::-;19558:2;19547:9;19540:21;19521:4;19578:61;19635:2;19624:9;19620:18;19612:6;19604;19578:61;:::i;:::-;-1:-1:-1;;;;;19675:55:76;;;19670:2;19655:18;;19648:83;19767:55;;;;19762:2;19747:18;;;19740:83;19570:69;19293:536;-1:-1:-1;;;19293:536:76:o;19834:674::-;20143:3;20132:9;20125:22;20106:4;20164:62;20221:3;20210:9;20206:19;20198:6;20190;20164:62;:::i;:::-;-1:-1:-1;;;;;20262:55:76;;;20257:2;20242:18;;20235:83;20354:55;;;20349:2;20334:18;;20327:83;-1:-1:-1;20446:55:76;;20441:2;20426:18;;;20419:83;;;;20156:70;19834:674;-1:-1:-1;;19834:674:76:o;22721:1462::-;22815:6;22868:2;22856:9;22847:7;22843:23;22839:32;22836:52;;;22884:1;22881;22874:12;22836:52;22924:9;22911:23;22957:18;22949:6;22946:30;22943:50;;;22989:1;22986;22979:12;22943:50;23012:22;;23053:16;;;23089:4;23081:13;;23078:33;;;23107:1;23104;23097:12;23078:33;23133:22;;:::i;:::-;23193:2;23180:16;23221:18;23211:8;23208:32;23205:52;;;23253:1;23250;23243:12;23205:52;23280:56;23328:7;23317:8;23313:2;23309:17;23280:56;:::i;:::-;23273:5;23266:71;;23382:2;23378;23374:11;23361:25;23395:33;23420:7;23395:33;:::i;:::-;23455:2;23444:14;;23437:31;23561:2;23492:66;23484:75;;23480:84;23477:104;;;23577:1;23574;23567:12;23477:104;23605:22;;:::i;:::-;23590:37;;23672:2;23668;23664:11;23651:25;23707:1;23698:7;23695:14;23685:42;;23723:1;23720;23713:12;23685:42;23736:24;;23826:2;23818:11;;23805:25;23859:2;23846:16;;23839:33;23899:2;23888:14;;23881:31;;;23944:29;23968:3;23960:12;;23944:29;:::i;:::-;23939:2;23928:14;;23921:53;24040:3;24032:12;;24019:26;24072:3;24061:15;;24054:32;;;24019:26;-1:-1:-1;24119:33:76;24146:4;24138:13;;24119:33;:::i;:::-;24113:3;24102:15;;24095:58;24106:5;22721:1462;-1:-1:-1;;;;;22721:1462:76:o;24188:184::-;24240:77;24237:1;24230:88;24337:4;24334:1;24327:15;24361:4;24358:1;24351:15;24630:1240;24725:6;24778:2;24766:9;24757:7;24753:23;24749:32;24746:52;;;24794:1;24791;24784:12;24746:52;24834:9;24821:23;24867:18;24859:6;24856:30;24853:50;;;24899:1;24896;24889:12;24853:50;24922:22;;24978:4;24960:16;;;24956:27;24953:47;;;24996:1;24993;24986:12;24953:47;25022:22;;:::i;:::-;25082:2;25069:16;25110:18;25100:8;25097:32;25094:52;;;25142:1;25139;25132:12;25094:52;25169:56;25217:7;25206:8;25202:2;25198:17;25169:56;:::i;:::-;25162:5;25155:71;;25271:2;25267;25263:11;25250:25;25284:33;25309:7;25284:33;:::i;:::-;25344:2;25333:14;;25326:31;25423:2;25415:11;;;25402:25;25443:14;;;25436:31;25512:2;25504:11;;25491:25;25525:30;25491:25;25525:30;:::i;:::-;25582:2;25571:14;;25564:31;25661:3;25653:12;;;25640:26;25682:15;;;25675:32;25752:3;25744:12;;;25731:26;;25766:33;25731:26;25766:33;:::i;:::-;25826:3;25815:15;;25808:32;;;;25819:5;24630:1240;-1:-1:-1;;;24630:1240:76:o;25875:456::-;25963:6;25971;25979;26032:2;26020:9;26011:7;26007:23;26003:32;26000:52;;;26048:1;26045;26038:12;26000:52;-1:-1:-1;;26093:16:76;;26199:2;26184:18;;26178:25;26295:2;26280:18;;;26274:25;26093:16;;26178:25;;-1:-1:-1;26274:25:76;25875:456;-1:-1:-1;25875:456:76:o;26638:617::-;26680:5;26733:3;26726:4;26718:6;26714:17;26710:27;26700:55;;26751:1;26748;26741:12;26700:55;26791:6;26778:20;26821:18;26813:6;26810:30;26807:56;;;26843:18;;:::i;:::-;26887:118;26999:4;-1:-1:-1;;26923:4:76;26915:6;26911:17;26907:90;26903:101;26887:118;:::i;:::-;27030:6;27021:7;27014:23;27084:3;27077:4;27068:6;27060;27056:19;27052:30;27049:39;27046:59;;;27101:1;27098;27091:12;27046:59;27166:6;27159:4;27151:6;27147:17;27140:4;27131:7;27127:18;27114:59;27222:1;27193:20;;;27215:4;27189:31;27182:42;;;;27197:7;26638:617;-1:-1:-1;;;26638:617:76:o;27260:1265::-;27371:6;27379;27432:2;27420:9;27411:7;27407:23;27403:32;27400:52;;;27448:1;27445;27438:12;27400:52;27488:9;27475:23;27521:18;27513:6;27510:30;27507:50;;;27553:1;27550;27543:12;27507:50;27576:49;27617:7;27608:6;27597:9;27593:22;27576:49;:::i;:::-;27566:59;;;27678:2;27667:9;27663:18;27650:32;27707:18;27697:8;27694:32;27691:52;;;27739:1;27736;27729:12;27691:52;27762:24;;27817:4;27809:13;;27805:27;-1:-1:-1;27795:55:76;;27846:1;27843;27836:12;27795:55;27886:2;27873:16;27909:64;27925:47;27965:6;27925:47;:::i;27909:64::-;27995:3;28019:6;28014:3;28007:19;28051:2;28046:3;28042:12;28035:19;;28106:2;28096:6;28093:1;28089:14;28085:2;28081:23;28077:32;28063:46;;28132:7;28124:6;28121:19;28118:39;;;28153:1;28150;28143:12;28118:39;28185:2;28181;28177:11;28197:298;28213:6;28208:3;28205:15;28197:298;;;28299:3;28286:17;28335:18;28322:11;28319:35;28316:55;;;28367:1;28364;28357:12;28316:55;28396:56;28444:7;28439:2;28425:11;28421:2;28417:20;28413:29;28396:56;:::i;:::-;28384:69;;-1:-1:-1;28482:2:76;28473:12;;;;28230;28197:298;;;28201:3;28514:5;28504:15;;;;;;27260:1265;;;;;:::o;28530:524::-;28623:6;28631;28639;28692:2;28680:9;28671:7;28667:23;28663:32;28660:52;;;28708:1;28705;28698:12;28660:52;28747:9;28734:23;28766:31;28791:5;28766:31;:::i;:::-;28816:5;-1:-1:-1;28873:2:76;28858:18;;28845:32;28886:33;28845:32;28886:33;:::i;:::-;28530:524;;28938:7;;-1:-1:-1;;;29018:2:76;29003:18;;;;28990:32;;28530:524::o;29059:245::-;29126:6;29179:2;29167:9;29158:7;29154:23;29150:32;29147:52;;;29195:1;29192;29185:12;29147:52;29227:9;29221:16;29246:28;29268:5;29246:28;:::i","linkReferences":{"V3/src/metarouter/libraries/ClaimsLib.sol":{"ClaimsLib":[{"start":8302,"length":20},{"start":8494,"length":20}]},"V3/src/metarouter/libraries/StakingLib.sol":{"StakingLib":[{"start":7754,"length":20},{"start":8011,"length":20}]},"V3/src/metarouter/libraries/PaymentsLib.sol":{"PaymentsLib":[{"start":5934,"length":20},{"start":6073,"length":20},{"start":6163,"length":20},{"start":6352,"length":20},{"start":6575,"length":20},{"start":6698,"length":20}]},"V3/src/metarouter/libraries/LiquidityLib.sol":{"LiquidityLib":[{"start":7407,"length":20},{"start":7531,"length":20}]},"V3/src/metarouter/libraries/ClPositionLib.sol":{"ClPositionLib":[{"start":6787,"length":20},{"start":6911,"length":20},{"start":7035,"length":20},{"start":7159,"length":20},{"start":7283,"length":20}]},"V3/src/metarouter/libraries/CrosschainLib.sol":{"CrosschainLib":[{"start":8618,"length":20},{"start":8841,"length":20},{"start":9155,"length":20}]},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"StakeRelayLib":[{"start":9403,"length":20},{"start":9651,"length":20}]}},"cborAuxdata":{"1":{"value":"0xa26469706673582212200b9b76d18116ba4fbcf799f853e027611cf243b1ac3e7152fe22d5efe86925cc64736f6c63430008240033","offset":22119}},"immutableReferences":{"9188":[{"start":2836,"length":32}],"9192":[{"start":247,"length":32},{"start":901,"length":32},{"start":6215,"length":32},{"start":6388,"length":32},{"start":6438,"length":32},{"start":6611,"length":32}],"9196":[{"start":850,"length":32},{"start":7617,"length":32},{"start":7790,"length":32},{"start":7874,"length":32},{"start":8047,"length":32},{"start":8165,"length":32},{"start":8338,"length":32},{"start":8927,"length":32},{"start":9191,"length":32}],"9200":[{"start":627,"length":32},{"start":8081,"length":32},{"start":8372,"length":32},{"start":9225,"length":32}],"9204":[{"start":799,"length":32},{"start":8654,"length":32},{"start":8704,"length":32},{"start":8877,"length":32}],"9208":[{"start":1121,"length":32},{"start":6823,"length":32},{"start":6947,"length":32},{"start":7071,"length":32},{"start":7195,"length":32},{"start":7319,"length":32},{"start":7443,"length":32},{"start":7567,"length":32},{"start":7824,"length":32},{"start":8115,"length":32},{"start":8406,"length":32},{"start":8530,"length":32},{"start":16420,"length":32}],"9211":[{"start":952,"length":32},{"start":9026,"length":32},{"start":9275,"length":32},{"start":9523,"length":32}],"9215":[{"start":729,"length":32},{"start":9439,"length":32},{"start":9687,"length":32}],"9219":[{"start":402,"length":32},{"start":9473,"length":32}],"9223":[{"start":1070,"length":32},{"start":9721,"length":32}],"9227":[{"start":678,"length":32},{"start":3525,"length":32},{"start":3608,"length":32},{"start":3870,"length":32},{"start":4250,"length":32},{"start":4414,"length":32}],"9230":[{"start":562,"length":32},{"start":3691,"length":32},{"start":4352,"length":32},{"start":4519,"length":32}]},"transformations":[{"id":"9192","type":"replace","offset":247,"reason":"immutable"},{"id":"9219","type":"replace","offset":402,"reason":"immutable"},{"id":"9230","type":"replace","offset":562,"reason":"immutable"},{"id":"9200","type":"replace","offset":627,"reason":"immutable"},{"id":"9227","type":"replace","offset":678,"reason":"immutable"},{"id":"9215","type":"replace","offset":729,"reason":"immutable"},{"id":"9204","type":"replace","offset":799,"reason":"immutable"},{"id":"9196","type":"replace","offset":850,"reason":"immutable"},{"id":"9192","type":"replace","offset":901,"reason":"immutable"},{"id":"9211","type":"replace","offset":952,"reason":"immutable"},{"id":"9223","type":"replace","offset":1070,"reason":"immutable"},{"id":"9208","type":"replace","offset":1121,"reason":"immutable"},{"id":"9188","type":"replace","offset":2836,"reason":"immutable"},{"id":"9227","type":"replace","offset":3525,"reason":"immutable"},{"id":"9227","type":"replace","offset":3608,"reason":"immutable"},{"id":"9230","type":"replace","offset":3691,"reason":"immutable"},{"id":"9227","type":"replace","offset":3870,"reason":"immutable"},{"id":"9227","type":"replace","offset":4250,"reason":"immutable"},{"id":"9230","type":"replace","offset":4352,"reason":"immutable"},{"id":"9227","type":"replace","offset":4414,"reason":"immutable"},{"id":"9230","type":"replace","offset":4519,"reason":"immutable"},{"id":"9192","type":"replace","offset":6215,"reason":"immutable"},{"id":"9192","type":"replace","offset":6388,"reason":"immutable"},{"id":"9192","type":"replace","offset":6438,"reason":"immutable"},{"id":"9192","type":"replace","offset":6611,"reason":"immutable"},{"id":"9208","type":"replace","offset":6823,"reason":"immutable"},{"id":"9208","type":"replace","offset":6947,"reason":"immutable"},{"id":"9208","type":"replace","offset":7071,"reason":"immutable"},{"id":"9208","type":"replace","offset":7195,"reason":"immutable"},{"id":"9208","type":"replace","offset":7319,"reason":"immutable"},{"id":"9208","type":"replace","offset":7443,"reason":"immutable"},{"id":"9208","type":"replace","offset":7567,"reason":"immutable"},{"id":"9196","type":"replace","offset":7617,"reason":"immutable"},{"id":"9196","type":"replace","offset":7790,"reason":"immutable"},{"id":"9208","type":"replace","offset":7824,"reason":"immutable"},{"id":"9196","type":"replace","offset":7874,"reason":"immutable"},{"id":"9196","type":"replace","offset":8047,"reason":"immutable"},{"id":"9200","type":"replace","offset":8081,"reason":"immutable"},{"id":"9208","type":"replace","offset":8115,"reason":"immutable"},{"id":"9196","type":"replace","offset":8165,"reason":"immutable"},{"id":"9196","type":"replace","offset":8338,"reason":"immutable"},{"id":"9200","type":"replace","offset":8372,"reason":"immutable"},{"id":"9208","type":"replace","offset":8406,"reason":"immutable"},{"id":"9208","type":"replace","offset":8530,"reason":"immutable"},{"id":"9204","type":"replace","offset":8654,"reason":"immutable"},{"id":"9204","type":"replace","offset":8704,"reason":"immutable"},{"id":"9204","type":"replace","offset":8877,"reason":"immutable"},{"id":"9196","type":"replace","offset":8927,"reason":"immutable"},{"id":"9211","type":"replace","offset":9026,"reason":"immutable"},{"id":"9196","type":"replace","offset":9191,"reason":"immutable"},{"id":"9200","type":"replace","offset":9225,"reason":"immutable"},{"id":"9211","type":"replace","offset":9275,"reason":"immutable"},{"id":"9215","type":"replace","offset":9439,"reason":"immutable"},{"id":"9219","type":"replace","offset":9473,"reason":"immutable"},{"id":"9211","type":"replace","offset":9523,"reason":"immutable"},{"id":"9215","type":"replace","offset":9687,"reason":"immutable"},{"id":"9223","type":"replace","offset":9721,"reason":"immutable"},{"id":"9208","type":"replace","offset":16420,"reason":"immutable"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":6787,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":6911,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":7035,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":7159,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib","type":"replace","offset":7283,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClaimsLib.sol:ClaimsLib","type":"replace","offset":8302,"reason":"library"},{"id":"V3/src/metarouter/libraries/ClaimsLib.sol:ClaimsLib","type":"replace","offset":8494,"reason":"library"},{"id":"V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib","type":"replace","offset":8618,"reason":"library"},{"id":"V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib","type":"replace","offset":8841,"reason":"library"},{"id":"V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib","type":"replace","offset":9155,"reason":"library"},{"id":"V3/src/metarouter/libraries/LiquidityLib.sol:LiquidityLib","type":"replace","offset":7407,"reason":"library"},{"id":"V3/src/metarouter/libraries/LiquidityLib.sol:LiquidityLib","type":"replace","offset":7531,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":5934,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":6073,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":6163,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":6352,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":6575,"reason":"library"},{"id":"V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib","type":"replace","offset":6698,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakeRelayLib.sol:StakeRelayLib","type":"replace","offset":9403,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakeRelayLib.sol:StakeRelayLib","type":"replace","offset":9651,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakingLib.sol:StakingLib","type":"replace","offset":7754,"reason":"library"},{"id":"V3/src/metarouter/libraries/StakingLib.sol:StakingLib","type":"replace","offset":8011,"reason":"library"},{"id":"1","type":"replace","offset":22119,"reason":"cborAuxdata"}],"transformationValues":{"libraries":{"V3/src/metarouter/libraries/ClaimsLib.sol:ClaimsLib":"0x8eda4655fd8e6bb3aff3d3f36610b1efec24aa22","V3/src/metarouter/libraries/StakingLib.sol:StakingLib":"0xe463e88df582c0b7a6d530f85c2c6954fb4f3c00","V3/src/metarouter/libraries/PaymentsLib.sol:PaymentsLib":"0xa37042e33c31e41b74bf18f0c1b27000f10e9e13","V3/src/metarouter/libraries/LiquidityLib.sol:LiquidityLib":"0x0028a78d20d2d5d230cc4b2a23b90793a95cb691","V3/src/metarouter/libraries/ClPositionLib.sol:ClPositionLib":"0x96fa373a6d7930d67accf441529ccf3477405493","V3/src/metarouter/libraries/CrosschainLib.sol:CrosschainLib":"0x47a3b182d028d503a6e6cd2bd1b4c11960d12113","V3/src/metarouter/libraries/StakeRelayLib.sol:StakeRelayLib":"0xff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e"},"immutables":{"9188":"0x0000000000000000000000000fef9e88a7b76bcdbf451780c6774fe32965ee98","9192":"0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","9196":"0x000000000000000000000000382409fad8503fbcdbb27a4211551fa03e884078","9200":"0x0000000000000000000000009e148c5716b5aadcfd3b71ceae9ee7a9e22c29e2","9204":"0x000000000000000000000000d61f078592ced81449a7405d837ff1b963b830ea","9208":"0x000000000000000000000000dd1705e23762f4d6e44d8c31bd8ea80c54612239","9211":"0x0000000000000000000000000000000000000000000000000000000000000000","9215":"0x0000000000000000000000000000000000000000000000000000000000000000","9219":"0x0000000000000000000000000000000000000000000000000000000000000000","9223":"0x0000000000000000000000000000000000000000000000000000000000000000","9227":"0x0000000000000000000000000000000000000000000000000000000000000000","9230":"0x0000000000000000000000000000000000000000000000000000000000000000"},"cborAuxdata":{"1":"0xa2646970667358221220b8a30eb1e02532ff610779827384314975eaddd07be359e3ffd777d2332607ad64736f6c63430008240033"}}},"deployment":{"transactionHash":"0x057d1f64e09b33fb90ae5490b6ab1c75cbabec833084761c3fc7054ded2f9846","blockNumber":"26234023","transactionIndex":"200","deployer":"0xCaF2C1251465C90D91A16b2288D9d6389f836A0E"},"sources":{"V3/src/metarouter/Metarouter.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {IERC20Metadata} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport {IERC721Receiver} from '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\n\nimport {TransientTracking} from 'V3/metarouter/TransientTracking.sol';\nimport {ClPositionLib} from 'V3/metarouter/libraries/ClPositionLib.sol';\nimport {ClaimsLib} from 'V3/metarouter/libraries/ClaimsLib.sol';\nimport {Commands} from 'V3/metarouter/libraries/Commands.sol';\nimport {CrosschainLib} from 'V3/metarouter/libraries/CrosschainLib.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {LiquidityLib} from 'V3/metarouter/libraries/LiquidityLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {PaymentsLib} from 'V3/metarouter/libraries/PaymentsLib.sol';\nimport {StakeRelayLib} from 'V3/metarouter/libraries/StakeRelayLib.sol';\nimport {StakingLib} from 'V3/metarouter/libraries/StakingLib.sol';\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IInterchainAccountRouter} from 'V3/interfaces/external/IInterchainAccountRouter.sol';\nimport {IWETH} from 'V3/interfaces/external/IWETH.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IPoolFactory} from 'V3/interfaces/factories/IPoolFactory.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ICLPool} from 'V3/interfaces/pools/ICLPool.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\nimport {IRelayFactoryRegistry} from 'V3/interfaces/relay/IRelayFactoryRegistry.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\n\n/**\n * @title Metarouter\n * @notice Permissionless router for executing composable command batches with temporary asset custody,\n *         returning remaining batch ERC20 and native balances to the original caller when execution ends. Positions\n *         are not returned: one brought into custody must be sent onward by a later command, or closure reverts.\n * @dev Virtual functions allow future variants to inherit from this contract and override selected behavior.\n */\ncontract Metarouter is IMetarouter, IERC721Receiver {\n  using SafeERC20 for IERC20;\n\n  /// @notice Canonical pool-type label reported by V2 stable pools.\n  bytes32 internal constant _V2_STABLE_POOL_TYPE = 'V2_STABLE';\n  /// @notice Canonical pool-type label reported by V2 volatile pools.\n  bytes32 internal constant _V2_VOLATILE_POOL_TYPE = 'V2_VOLATILE';\n  /// @notice Canonical pool-type label reported by CL pools.\n  bytes32 internal constant _CL_POOL_TYPE = 'CL';\n  /// @notice Lowest usable CL square-root price, one unit above the pool boundary.\n  uint160 internal constant _MIN_SQRT_RATIO_PLUS_ONE = 4_295_128_740;\n  /// @notice Highest usable CL square-root price, one unit below the pool boundary.\n  uint160 internal constant _MAX_SQRT_RATIO_MINUS_ONE =\n    1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_341;\n\n  /// @notice Address this router was deployed at; `_checkExecutionContext` uses it to reject delegatecalls.\n  address internal immutable _IMPLEMENTATION = address(this);\n\n  /// @inheritdoc IMetarouter\n  IWETH public immutable WETH;\n  /// @inheritdoc IMetarouter\n  ILeafVoter public immutable LEAF_VOTER;\n  /// @inheritdoc IMetarouter\n  IERC20 public immutable EMISSION_TOKEN;\n  /// @inheritdoc IMetarouter\n  IInterchainAccountRouter public immutable ICA_ROUTER;\n  /// @inheritdoc IMetarouter\n  IFactoryRegistry public immutable FACTORY_REGISTRY;\n  /// @inheritdoc IMetarouter\n  bool public immutable IS_ROOT;\n  /// @inheritdoc IMetarouter\n  IVotingEscrow public immutable STAKING_ESCROW;\n  /// @inheritdoc IMetarouter\n  IERC20 public immutable STAKING_TOKEN;\n  /// @inheritdoc IMetarouter\n  IRelayFactoryRegistry public immutable RELAY_FACTORY_REGISTRY;\n  /// @inheritdoc IMetarouter\n  IERC20 public immutable NATIVE_ERC20;\n  /// @inheritdoc IMetarouter\n  uint256 public immutable NATIVE_ERC20_SCALE;\n\n  /**\n   * @notice Initializes the Metarouter.\n   * @dev The emission token and the staking escrow are derived from the protocol, not passed. On root (this chain\n   *      equals the leaf voter's orchestrator `ROOT_CHAIN_ID`) the emission token is the root Voter's `MINTER().TOKEN()`\n   *      and the staking escrow is the root Voter's `VOTING_ESCROW()`, the canonical escrow `CREATE_STAKE` and\n   *      `DEPOSIT_RELAY` act on; on leaf the emission token is the leaf voter's `RECEIPT_TOKEN` and the staking\n   *      immutables stay zero. Derived values come from protocol contracts that validate them at their own\n   *      construction, so only the constructor's own inputs are zero-checked here.\n   *\n   *      A lite deployment ships without the voting system and without the cross-chain layer, so `_leafVoter` and\n   *      `_icaRouter` may be zero. A zero voter makes `IS_ROOT` false, leaves the emission token zero, and disables the\n   *      gauge staking and claim commands; a zero ICA router disables `EXECUTE_CROSS_CHAIN` and the `BRIDGE_TOKEN`\n   *      path that derives a destination interchain account. Those revert with `CommandDisabled` when dispatched,\n   *      while a `BRIDGE_TOKEN` naming a direct recipient stays available.\n   * @param _weth Wrapped native token used by payment commands. Zero on a chain with no wrapped-native token, where\n   *        `WRAP_ETH` and `UNWRAP_WETH` revert with `CommandDisabled`. Never the native ERC20.\n   * @param _leafVoter Leaf Voter used to validate gauge targets and, on leaf, to resolve the emission `ReceiptToken`.\n   *        Zero on a lite deployment with no voting system, where the gauge staking and claim commands are disabled.\n   * @param _rootVoter Root Voter used only on root to resolve the emission token and the staking escrow; unused on leaf.\n   * @param _icaRouter Interchain account router used by the cross-chain commands. Zero on a lite deployment with no\n   *        cross-chain layer, where every command that derives an interchain account is disabled.\n   * @param _relayFactoryRegistry RelayFactoryRegistry used only on root to authenticate `DEPOSIT_RELAY` relays through\n   *        their factory; unused on leaf.\n   * @param _factoryRegistry Registry used to authenticate recorded pools and CL factories, require factory approval\n   *        for pool creation, and resolve permanent factory relationships backing position managers.\n   * @param _nativeErc20 ERC20 entry point of the chain's native asset, whose spend resolution and closing sweep are\n   *        capped so they cannot drain the pre-batch native balance. Zero on a chain whose native asset has no ERC20\n   *        entry point. A nonzero native ERC20 must report its decimals: the native-to-token scale is derived from\n   *        them, so a native ERC20 expressing the native asset in fewer decimals than native's eighteen converts correctly.\n   */\n  constructor(\n    IWETH _weth,\n    ILeafVoter _leafVoter,\n    IVoter _rootVoter,\n    IInterchainAccountRouter _icaRouter,\n    IRelayFactoryRegistry _relayFactoryRegistry,\n    IFactoryRegistry _factoryRegistry,\n    IERC20 _nativeErc20\n  ) {\n    if (address(_factoryRegistry) == address(0)) revert ZeroAddress();\n    WETH = _weth;\n    LEAF_VOTER = _leafVoter;\n    ICA_ROUTER = _icaRouter;\n    FACTORY_REGISTRY = _factoryRegistry;\n    NATIVE_ERC20 = _nativeErc20;\n    if (address(_nativeErc20) != address(0)) {\n      // The two roles are incompatible: wrap and unwrap would drive `deposit`/`withdraw` on the native ERC20 while the\n      // closing sweep treats the two tokens differently, so a collision is a misdeployment.\n      if (address(_weth) == address(_nativeErc20)) revert WethIsNativeErc20();\n      // Native balances always carry eighteen decimals; a native ERC20 may expose the same asset in fewer. Deriving the\n      // scale from the token's own decimals keeps the two unit systems convertible without a separate parameter.\n      uint8 _nativeErc20Decimals = IERC20Metadata(address(_nativeErc20)).decimals();\n      if (_nativeErc20Decimals > 18) revert InvalidNativeErc20Decimals();\n      NATIVE_ERC20_SCALE = 10 ** (18 - _nativeErc20Decimals);\n    }\n    // A lite deployment has no voter to ask, so it is never the root: the root-only commands stay gated off.\n    IS_ROOT = address(_leafVoter) != address(0) && block.chainid == _leafVoter.ORCHESTRATOR().ROOT_CHAIN_ID();\n\n    if (IS_ROOT) {\n      if (address(_rootVoter) == address(0)) revert ZeroAddress();\n      if (address(_relayFactoryRegistry) == address(0)) revert ZeroAddress();\n      EMISSION_TOKEN = IERC20(_rootVoter.MINTER().TOKEN());\n      STAKING_ESCROW = _rootVoter.VOTING_ESCROW();\n      STAKING_TOKEN = IERC20(address(STAKING_ESCROW.TOKEN()));\n      RELAY_FACTORY_REGISTRY = _relayFactoryRegistry;\n    } else {\n      // Leaf: no VotingEscrow or Relay, so the staking immutables stay zero and IS_ROOT gates their commands off.\n      // A lite deployment has no voter to resolve the receipt token from, so the emission token stays zero too.\n      if (address(_leafVoter) != address(0)) EMISSION_TOKEN = IERC20(address(_leafVoter.RECEIPT_TOKEN()));\n    }\n  }\n\n  /// @notice Accepts WETH withdrawals and native refunds received during an active batch.\n  receive() external payable virtual {\n    // WETH withdrawals are always accepted. Other native inflows are accepted only while an\n    // outer batch is active and are returned at closure.\n    if (msg.sender != address(WETH) && TransientTracking.load(MetarouterState.LOCKER_SLOT) == 0) {\n      revert InvalidEthSender();\n    }\n  }\n\n  /**\n   * @inheritdoc IERC721Receiver\n   * @dev Accepts a position only while a batch is active, and only when the calling collection, the sender, and the\n   *      position all match what the active command set through `MetarouterState.setExpectedNft`, then records the\n   *      `(collection, tokenId)` pair for the closing ownership check. A CL gauge returns unstaked positions through\n   *      `safeTransferFrom`, which is why the router implements the receiver.\n   *\n   *      This check is the custody boundary. A tracked position is one later commands may operate, so accepting an\n   *      unsolicited transfer would let a third party hand the active batch authority over a position it never asked\n   *      for. An unset slot reads zero and is rejected outright rather than compared, so a hook call reporting a zero\n   *      `_from` cannot slip through while the router expects nothing. Matching the token id too keeps a misbehaving\n   *      gauge from returning a different position than the one the command asked back.\n   *\n   *      The collection is matched rather than compared against a canonical manager: the router holds none, so each\n   *      command publishes the manager it resolved. Every argument here except `msg.sender` is chosen by the caller, so\n   *      without that comparison any contract could present the expected sender and token id and be recorded as a\n   *      custodied collection, and a position from one manager could satisfy state armed for another that issued the\n   *      same id.\n   */\n  function onERC721Received(\n    address,\n    address _from,\n    uint256 _tokenId,\n    bytes calldata\n  ) external virtual returns (bytes4 _selector) {\n    if (TransientTracking.load(MetarouterState.LOCKER_SLOT) == 0) revert BatchNotActive();\n    (address _expectedCollection, address _expectedSender, uint256 _expectedTokenId) = MetarouterState.expectedNft();\n    // Checked before the collection so an unsolicited transfer, which finds every field zero, reports that the router\n    // solicited nothing rather than naming a collection mismatch.\n    if (_expectedSender == address(0)) revert UnexpectedNftSender();\n    if (msg.sender != _expectedCollection) revert InvalidNftSender();\n    if (_from != _expectedSender) revert UnexpectedNftSender();\n    if (_tokenId != _expectedTokenId) revert UnexpectedNftSender();\n    // Consume the one-shot authorization before recording custody. The initiating withdrawal requires this state to\n    // be cleared when the gauge returns, so a successful call proves that this exact receiver path ran.\n    MetarouterState.clearExpectedNft();\n    MetarouterState.trackNft(msg.sender, _tokenId);\n    return IERC721Receiver.onERC721Received.selector;\n  }\n\n  // ============================== Execution ==============================\n\n  /// @inheritdoc IMetarouter\n  function execute(bytes calldata _commands, bytes[] calldata _inputs, uint256 _deadline) external payable virtual {\n    _checkExecutionContext();\n    if (_commands.length != _inputs.length) revert LengthMismatch();\n    if (block.timestamp > _deadline) revert Expired();\n\n    if (TransientTracking.load(MetarouterState.LOCKER_SLOT) != 0) {\n      // While a batch is active, only the router's own self-called child frames may reenter.\n      if (msg.sender != address(this)) revert ContractLocked();\n      _executeCommands(_commands, _inputs);\n      return;\n    }\n\n    _beginExecution();\n    address _sender = MetarouterState.msgSender();\n    _executeCommands(_commands, _inputs);\n    _endExecution(_sender);\n    emit BatchExecuted(_sender);\n  }\n\n  /// @inheritdoc IMetarouter\n  function uniswapV3SwapCallback(int256 _amount0Delta, int256 _amount1Delta, bytes calldata _data) external virtual {\n    _checkExecutionContext();\n    // No locker check needed: the expected callback caller slot can only be armed while a batch swap is executing.\n    address _expectedCaller = address(uint160(TransientTracking.load(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT)));\n    if (msg.sender != _expectedCaller) revert InvalidCallbackCaller(msg.sender);\n    TransientTracking.store(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT, 0);\n\n    // Exactly one delta is positive: the token owed to the pool.\n    bool _amount0Positive = _amount0Delta > 0;\n    bool _amount1Positive = _amount1Delta > 0;\n    if (_amount0Positive == _amount1Positive) revert InvalidCallbackDeltas();\n\n    uint256 _amountToPay = uint256(_amount0Positive ? _amount0Delta : _amount1Delta);\n    ClSwapCallbackData memory _callback = abi.decode(_data, (ClSwapCallbackData));\n\n    // Settle the invoice by swapping the previous route pool's exact output straight to the caller.\n    if (_callback.remaining > 0) {\n      uint256 _hop = --_callback.remaining;\n      // The caller pool verifies its own balance afterwards, so a partial inner fill makes it revert.\n      _clSwap(\n        _callback.pools[_hop], _callback.zeroForOne[_hop], -int256(_amountToPay), msg.sender, abi.encode(_callback)\n      );\n      return;\n    }\n\n    // Reverts if the pool requests more than the authorized maximum.\n    if (_amountToPay > _callback.maxAmountIn) revert TooMuchRequested();\n    FundsLib.pay(_callback.tokenIn, _callback.payer, msg.sender, _amountToPay);\n  }\n\n  /// @inheritdoc IMetarouter\n  function msgSender() external view virtual override returns (address _sender) {\n    return MetarouterState.msgSender();\n  }\n\n  /**\n   * @notice Executes commands without opening or closing another custody frame.\n   * @param _commands One command byte per input.\n   * @param _inputs ABI-encoded arguments corresponding to each command byte.\n   */\n  function _executeCommands(bytes calldata _commands, bytes[] calldata _inputs) internal virtual {\n    uint256 _length = _commands.length;\n    for (uint256 _i; _i < _length; ++_i) {\n      (uint256 _commandType, bool _allowRevert) = _decode(_commands[_i]);\n      if (!_allowRevert) {\n        _dispatch(_commandType, _inputs[_i]);\n      } else {\n        bytes memory _childCommands = abi.encodePacked(bytes1(uint8(_commandType)));\n        bytes[] memory _childInputs = new bytes[](1);\n        _childInputs[0] = _inputs[_i];\n        // Run in a fresh frame so a failure rolls back the command's state changes while the batch continues.\n        try this.execute(_childCommands, _childInputs, type(uint256).max) {} catch {}\n      }\n    }\n  }\n\n  /**\n   * @notice Opens the batch: records the outer caller as locker, snapshots the pre-batch native balance, and\n   *         publishes the native ERC20 for balance resolution.\n   */\n  function _beginExecution() internal virtual {\n    TransientTracking.store(MetarouterState.LOCKER_SLOT, uint256(uint160(msg.sender)));\n    TransientTracking.store(MetarouterState.NATIVE_BALANCE_BEFORE_SLOT, address(this).balance - msg.value);\n    // The command libraries run via delegatecall and cannot read the immutables, so `availableErc20Balance` reads\n    // the native ERC20 token and its scale from these slots. Skipped when zero: no token ever matches an empty slot.\n    if (address(NATIVE_ERC20) != address(0)) {\n      TransientTracking.store(MetarouterState.NATIVE_ERC20_SLOT, uint256(uint160(address(NATIVE_ERC20))));\n      TransientTracking.store(MetarouterState.NATIVE_ERC20_SCALE_SLOT, NATIVE_ERC20_SCALE);\n    }\n  }\n\n  /**\n   * @notice Returns every tracked ERC20 balance and any batch ETH to the recipient, verifies no tracked NFT remains,\n   *         then clears custody and the locker.\n   * @dev Tracked ERC20s are swept back to the recipient. The native ERC20 is skipped: its balance is the\n   *      router's native balance, so the native refund below already returns the batch's portion, and sweeping it\n   *      through the ERC20 entry point would drain the pre-batch native — or revert outright on an implementation\n   *      that demands a value-carrying `transfer`. A recipient that rejects the native refund is paid through the\n   *      native ERC20's entry point instead, so a custody-holding contract without a payable receiver still gets the batch\n   *      native back; without a native ERC20 the rejection reverts the closure. NFTs are checked rather than swept: a\n   *      position still owned by\n   *      the router means the route left it stranded, so closure reverts; a command that transferred it out (staked,\n   *      deposited, transferred) leaves the router as its non-owner, so the check passes. `BURN_CL_POSITION` untracks a\n   *      position it burns, so the ownership check skips it. A recipient may instead burn a transferred position from\n   *      its receiver hook while its custody flag remains set; in that case `ownerOf` reverting at closure proves that\n   *      the canonical position no longer exists and is treated as having left. Closure deliberately does not touch the\n   *      in-flight slots: every command that moves a tracked position out of the router must call\n   *      `MetarouterState.consumeInFlightNft` itself. Miss that and the stale pair survives into a later batch of the\n   *      same transaction, where the next producer command reverts with `InFlightNftPresent`.\n   * @param _recipient Address receiving the swept balances and ETH refund at closure.\n   */\n  function _endExecution(address _recipient) internal virtual {\n    uint256 _length = TransientTracking.length(MetarouterState.ERC20_ARRAY_SLOT);\n    for (uint256 _i; _i < _length; ++_i) {\n      address _token = TransientTracking.at(MetarouterState.ERC20_ARRAY_SLOT, _i);\n      TransientTracking.untrack(MetarouterState.TRACKED_SLOT, _token);\n      // The native ERC20's batch portion is native value the refund below already returns, and some native ERC20\n      // implementations reject a zero-value `transfer`, so its entry point is never swept.\n      if (_token == address(NATIVE_ERC20)) continue;\n      uint256 _balance = IERC20(_token).balanceOf(address(this));\n      if (_balance > 0) IERC20(_token).safeTransfer(_recipient, _balance);\n    }\n    TransientTracking.clear(MetarouterState.ERC20_ARRAY_SLOT);\n\n    uint256 _nativeRefund = MetarouterState.availableNativeBalance();\n    // slither-disable-next-line uninitialized-local\n    uint256 _allowedDust;\n    if (_nativeRefund > 0) {\n      (bool _success, bytes memory _data) = payable(_recipient).call{value: _nativeRefund}('');\n      if (!_success) {\n        // A rejecting recipient is paid through the native ERC20's entry point instead, which moves the same native\n        // without running their code; without a native ERC20 the rejection surfaces. The refund floors to raw\n        // native ERC20 units: the untransferable remainder is tolerated below and absorbed by the next batch's snapshot.\n        // If the native ERC20 also rejects, the native failure is re-raised with its original data.\n        if (address(NATIVE_ERC20) == address(0)) revert NativeTransferFailed(_data);\n        uint256 _refundAmount = _nativeRefund / NATIVE_ERC20_SCALE;\n        if (_refundAmount > 0 && !NATIVE_ERC20.trySafeTransfer(_recipient, _refundAmount)) {\n          revert NativeTransferFailed(_data);\n        }\n        _allowedDust = NATIVE_ERC20_SCALE - 1;\n      }\n    }\n    // A recipient that bounced native back into the router during the refund would leave a spendable balance behind;\n    // reject it so no native survives the batch beyond the remainder a native ERC20 refund cannot express.\n    // Post-refund the balance can only be at or above the pre-batch snapshot, so any residual surfaces as a non-zero\n    // available balance.\n    if (MetarouterState.availableNativeBalance() > _allowedDust) revert NativeBalanceNotCleared();\n\n    // The arrays are an append-only log of every position the batch touched; the per-NFT flag is the live \"still the\n    // router's responsibility\" bit. `trackNft` appends only when the flag is unset, so every entry is unique, and a\n    // command that releases a position clears its flag while its array entry stays behind.\n    uint256 _nftLength = MetarouterState.trackedNftLength();\n    for (uint256 _i; _i < _nftLength; ++_i) {\n      (address _collection, uint256 _tokenId) = MetarouterState.trackedNftAt(_i);\n      // Flag already cleared: the position was released mid-batch. Today only `BURN_CL_POSITION` does that, so the\n      // token no longer exists and `ownerOf` would revert on it. Nothing left to verify.\n      if (!MetarouterState.isNftInCustody(_collection, _tokenId)) continue;\n      try IERC721(_collection).ownerOf(_tokenId) returns (address _closureOwner) {\n        // Still owned by the router: the route brought the position in and never sent it on, so revert the whole batch\n        // rather than close and leave it trapped here.\n        if (_closureOwner == address(this)) revert NftNotCleared();\n      } catch {\n        // Custody admits only collections authenticated by a command or explicitly armed for a gauge return. Their\n        // `ownerOf` implementations have no application-level revert path for an existing token, so a revert is\n        // treated as the position having burned.\n      }\n      // It left the router. Clearing the flag is load-bearing, not housekeeping: `clearNftArrays` resets only the\n      // array lengths, so a flag surviving into a later batch of the same transaction would make that batch's\n      // `trackNft` dedupe the position away, leaving it out of the array and unverified at that batch's closure.\n      MetarouterState.untrackNft(_collection, _tokenId);\n    }\n    MetarouterState.clearNftArrays();\n\n    TransientTracking.store(MetarouterState.NATIVE_BALANCE_BEFORE_SLOT, 0);\n    TransientTracking.store(MetarouterState.LOCKER_SLOT, 0);\n  }\n\n  // ============================== Dispatch ==============================\n\n  /**\n   * @notice Routes a command to its handler, keeping control-flow commands inline and delegating group commands\n   *         to their libraries.\n   * @dev This function is the single validated boundary: an unknown command reverts here.\n   * @param _commandType Command ID with flags removed.\n   * @param _input ABI-encoded arguments for the command.\n   */\n  function _dispatch(uint256 _commandType, bytes calldata _input) internal virtual {\n    // Swaps stay inline because this hot path fits, other command groups use libraries to stay within the size limit.\n    if (_commandType == Commands.CL_SWAP_EXACT_IN) {\n      _clSwapExactIn(_input);\n    } else if (_commandType == Commands.CL_SWAP_EXACT_OUT) {\n      _clSwapExactOut(_input);\n    } else if (_commandType == Commands.V2_SWAP_EXACT_IN) {\n      _v2SwapExactIn(_input);\n    } else if (_commandType == Commands.V2_SWAP_EXACT_OUT) {\n      _v2SwapExactOut(_input);\n    }\n    // Control flow\n    else if (_commandType == Commands.EXECUTE_SUB_PLAN) {\n      _executeSubPlan(_input);\n    } else if (_commandType == Commands.BALANCE_CHECK) {\n      _balanceCheck(_input);\n    }\n    // Payments\n    else if (_commandType == Commands.SWEEP) {\n      PaymentsLib.sweep(_input);\n    } else if (_commandType == Commands.TRANSFER) {\n      PaymentsLib.transfer(_input);\n    } else if (_commandType == Commands.FUND_ERC20) {\n      PaymentsLib.fundErc20(_input);\n    } else if (_commandType == Commands.WRAP_ETH) {\n      if (address(WETH) == address(0)) revert CommandDisabled(_commandType);\n      PaymentsLib.wrapEth(_input, WETH);\n    } else if (_commandType == Commands.UNWRAP_WETH) {\n      if (address(WETH) == address(0)) revert CommandDisabled(_commandType);\n      PaymentsLib.unwrapWeth(_input, WETH);\n    } else if (_commandType == Commands.TRANSFER_NFT) {\n      PaymentsLib.transferNft(_input);\n    }\n    // CL positions\n    else if (_commandType == Commands.MINT_CL_POSITION) {\n      ClPositionLib.mintClPosition(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.INCREASE_CL_LIQUIDITY) {\n      ClPositionLib.increaseClLiquidity(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.DECREASE_CL_LIQUIDITY) {\n      ClPositionLib.decreaseClLiquidity(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.COLLECT_CL_FEES) {\n      ClPositionLib.collectClFees(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.BURN_CL_POSITION) {\n      ClPositionLib.burnClPosition(_input, FACTORY_REGISTRY);\n    }\n    // V2 liquidity\n    else if (_commandType == Commands.ADD_LIQUIDITY) {\n      LiquidityLib.addLiquidity(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.REMOVE_LIQUIDITY) {\n      LiquidityLib.removeLiquidity(_input, FACTORY_REGISTRY);\n    }\n    // Staking\n    else if (_commandType == Commands.STAKE_GAUGE) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      StakingLib.stakeGauge(_input, LEAF_VOTER, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.UNSTAKE_GAUGE) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      StakingLib.unstakeGauge(_input, LEAF_VOTER, EMISSION_TOKEN, FACTORY_REGISTRY);\n    }\n    // Claims\n    else if (_commandType == Commands.CLAIM_GAUGE_REWARDS) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      ClaimsLib.claimGaugeRewards(_input, LEAF_VOTER, EMISSION_TOKEN, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.CLAIM_V2_POOL_FEES) {\n      ClaimsLib.claimV2PoolFees(_input, FACTORY_REGISTRY);\n    }\n    // Cross-chain\n    else if (_commandType == Commands.BRIDGE_TOKEN) {\n      CrosschainLib.bridgeToken(_input, ICA_ROUTER);\n    } else if (_commandType == Commands.EXECUTE_CROSS_CHAIN) {\n      if (address(ICA_ROUTER) == address(0)) revert CommandDisabled(_commandType);\n      CrosschainLib.executeCrosschain(_input, ICA_ROUTER);\n    }\n    // `REDEEM` is leaf-only: root pays gauge emissions in `TOKEN` directly, so it holds no receipt to redeem and\n    // `EMISSION_TOKEN` is the canonical `TOKEN` there, not the `ReceiptToken` the leaf Voter burns.\n    else if (_commandType == Commands.REDEEM) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      if (IS_ROOT) revert NotLeaf(_commandType);\n      CrosschainLib.redeem(_input, LEAF_VOTER, EMISSION_TOKEN);\n    }\n    // sAERO / relay\n    // `CREATE_STAKE` and `DEPOSIT_RELAY` are root-only: the `VotingEscrow` and the relays exist only on the root\n    // deployment. On a leaf `IS_ROOT` is false, so `!IS_ROOT` is true and the command reverts.\n    else if (_commandType == Commands.CREATE_STAKE) {\n      if (!IS_ROOT) revert NotRoot(_commandType);\n      StakeRelayLib.createStake(_input, STAKING_ESCROW, STAKING_TOKEN);\n    } else if (_commandType == Commands.DEPOSIT_RELAY) {\n      if (!IS_ROOT) revert NotRoot(_commandType);\n      StakeRelayLib.depositRelay(_input, STAKING_ESCROW, RELAY_FACTORY_REGISTRY);\n    } else {\n      revert InvalidCommandType(_commandType);\n    }\n  }\n\n  // ============================== Swaps ==============================\n\n  /**\n   * @notice Executes a forward-ordered exact-input CL route.\n   * @dev The CL pool applies its contextual swap fee, including any configured MEV fee, and reports the resulting\n   *      input/output deltas through the callback and return values. Fee-on-transfer and other nonstandard pool\n   *      tokens are unsupported; routing and the minimum-output check use the canonical pool-reported deltas.\n   * @param _input ABI-encoded `SwapExactInParams`.\n   */\n  function _clSwapExactIn(bytes calldata _input) internal {\n    SwapExactInParams memory _params = abi.decode(_input, (SwapExactInParams));\n    // A user payer must specify an exact amount given wallet percentages are not resolvable.\n    if (_params.payerIsUser && _params.amountIn.mode != SpendMode.Amount) revert InvalidSpendMode();\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, true, _params.recipient);\n    uint256 _length = _params.pools.length;\n\n    // The user pays the first pool directly, or the execution address funds it.\n    uint256 _amountIn =\n      _params.payerIsUser ? _params.amountIn.value : FundsLib.fund(_params.tokenIn, _params.amountIn, false);\n    // Reverts if the first hop's user-supplied or funded input does not fit the pool's signed input type.\n    if (_amountIn > uint256(type(int256).max)) revert AmountOverflow();\n    address _payer = _params.payerIsUser ? MetarouterState.msgSender() : address(this);\n\n    // Exact-input callbacks never recurse through an earlier pool, so every hop reuses the same empty route arrays.\n    address[] memory _emptyPools = new address[](0);\n    bool[] memory _emptyZeroForOne = new bool[](0);\n\n    // Execute the swaps route.\n    for (uint256 _i; _i < _length; ++_i) {\n      // Send intermediate outputs to the metarouter and the final output to the recipient.\n      address _recipient = _i + 1 == _length ? _params.recipient : address(this);\n      if (_recipient == address(this)) MetarouterState.trackERC20(_tokens[_i + 1]);\n\n      // Authorize the pool callback, bound what it may pay, and execute the swap.\n      ClSwapCallbackData memory _callback = ClSwapCallbackData({\n        pools: _emptyPools,\n        zeroForOne: _emptyZeroForOne,\n        remaining: 0,\n        tokenIn: _tokens[_i],\n        payer: _payer,\n        maxAmountIn: _amountIn\n      });\n      (int256 _amount0, int256 _amount1) =\n        _clSwap(_params.pools[_i], _zeroForOne[_i], int256(_amountIn), _recipient, abi.encode(_callback));\n\n      // The negative output delta (amount out we swapped) magnitude becomes the next hop's input.\n      int256 _outputDelta = _zeroForOne[_i] ? _amount1 : _amount0;\n      if (_outputDelta > 0) revert InvalidSwapDeltas();\n      // Convert into positive and cast (safe to negate: no pool can send close to `type(int256).min`).\n      _amountIn = uint256(-_outputDelta);\n\n      // The execution address pays the following pools.\n      _payer = address(this);\n    }\n\n    // Reverts if the minimum received amount out is not met.\n    if (_amountIn < _params.minAmountOut) revert TooLittleReceived(_params.minAmountOut, _amountIn);\n  }\n\n  /**\n   * @notice Executes a forward-ordered exact-output CL route.\n   * @dev The last pool executes first and each pool's invoice is settled inside its callback by swapping the\n   *      previous route pool straight to it, so the payer only pays the first pool's invoice. That payment happens\n   *      lazily inside the callback with no upfront funding: the execution owner pays directly, or the execution\n   *      address pays from custody. Fee-on-transfer and other nonstandard pool tokens are unsupported.\n   * @param _input ABI-encoded `SwapExactOutParams`.\n   */\n  function _clSwapExactOut(bytes calldata _input) internal {\n    SwapExactOutParams memory _params = abi.decode(_input, (SwapExactOutParams));\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, true, _params.recipient);\n    uint256 _lastIndex = _params.pools.length - 1;\n\n    // If the final recipient is the Metarouter, track the output token.\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_tokens[_lastIndex + 1]);\n\n    // Reverts if the output amount does not fit the pool's signed amount type.\n    if (_params.amountOut > uint256(type(int256).max)) revert AmountOverflow();\n\n    // The user pays the first pool's invoice directly, or the execution address pays it from custody.\n    address _payer = _params.payerIsUser ? MetarouterState.msgSender() : address(this);\n    // Track custody-funded inputs so any unspent residual is swept back at batch closure.\n    if (!_params.payerIsUser) MetarouterState.trackERC20(_params.tokenIn);\n\n    // The route before the last pool settles its invoice recursively through the callback.\n    ClSwapCallbackData memory _callback = ClSwapCallbackData({\n      pools: _params.pools,\n      zeroForOne: _zeroForOne,\n      remaining: _lastIndex,\n      tokenIn: _params.tokenIn,\n      payer: _payer,\n      maxAmountIn: _params.maxAmountIn\n    });\n    (int256 _amount0, int256 _amount1) = _clSwap(\n      _params.pools[_lastIndex],\n      _zeroForOne[_lastIndex],\n      -int256(_params.amountOut),\n      _params.recipient,\n      abi.encode(_callback)\n    );\n\n    // Reverts if the pool delivers a different output than the exact requested amount.\n    int256 _outputDelta = _zeroForOne[_lastIndex] ? _amount1 : _amount0;\n    if (uint256(-_outputDelta) != _params.amountOut) revert InvalidAmountOut();\n  }\n\n  /**\n   * @notice Executes a forward-ordered exact-input V2 route through stable and volatile pools.\n   * @dev Each hop measures the input its pool actually received. Slippage is checked twice against `minAmountOut`:\n   *      the final hop's quote, before the swap runs, which an inflow to the recipient cannot inflate, and the\n   *      recipient balance delta as a backstop for an output token that under-delivers on transfer. Fee-on-transfer\n   *      and other nonstandard output tokens are unsupported: for them the quote is not a delivery guarantee and the\n   *      delta backstop might not be enough.\n   * @param _input ABI-encoded `SwapExactInParams`.\n   */\n  // slither-disable-start reentrancy-balance\n  function _v2SwapExactIn(bytes calldata _input) internal {\n    SwapExactInParams memory _params = abi.decode(_input, (SwapExactInParams));\n    // A user payer must specify an exact amount given wallet percentages are not resolvable.\n    if (_params.payerIsUser && _params.amountIn.mode != SpendMode.Amount) revert InvalidSpendMode();\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, false, _params.recipient);\n\n    // If the final recipient is the Metarouter, track the output token.\n    uint256 _length = _params.pools.length;\n    address _tokenOut = _tokens[_length];\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_tokenOut);\n\n    // The user pays the first pool directly, or the execution address funds it.\n    uint256 _amountIn =\n      _params.payerIsUser ? _params.amountIn.value : FundsLib.fund(_params.tokenIn, _params.amountIn, false);\n    FundsLib.pay(\n      _params.tokenIn, _params.payerIsUser ? MetarouterState.msgSender() : address(this), _params.pools[0], _amountIn\n    );\n\n    uint256 _balanceBefore = 0;\n\n    // Execute the swaps route.\n    for (uint256 _i; _i < _length; ++_i) {\n      uint256 _actualAmountIn;\n      {\n        // Measure the input amount received by the pool.\n        // slither-disable-next-line unused-return\n        (uint256 _reserve0, uint256 _reserve1,) = IPool(_params.pools[_i]).getReserves();\n        uint256 _reserveIn = _zeroForOne[_i] ? _reserve0 : _reserve1;\n        uint256 _poolBalance = IERC20(_tokens[_i]).balanceOf(_params.pools[_i]);\n        if (_poolBalance < _reserveIn) revert InvalidReserves(_params.pools[_i]);\n        _actualAmountIn = _poolBalance - _reserveIn;\n      }\n\n      // Route intermediate output to the next pool and final output to the recipient after snapshotting its balance.\n      uint256 _amountOut = IPool(_params.pools[_i]).getAmountOutWithTotalFee(_actualAmountIn, _tokens[_i]);\n      address _recipient;\n      if (_i + 1 < _length) {\n        _recipient = _params.pools[_i + 1];\n      } else {\n        // The quote cannot be inflated by an inflow to the recipient, so it enforces the minimum before the swap runs.\n        if (_amountOut < _params.minAmountOut) revert TooLittleReceived(_params.minAmountOut, _amountOut);\n        _recipient = _params.recipient;\n        // Snapshot immediately before the final swap so earlier route inflows cannot inflate the received amount.\n        _balanceBefore = IERC20(_tokenOut).balanceOf(_recipient);\n      }\n      _v2Swap(_params.pools[_i], _zeroForOne[_i], _amountOut, _recipient);\n    }\n\n    // Reverts if the minimum received amount out is not met.\n    uint256 _received = IERC20(_tokenOut).balanceOf(_params.recipient) - _balanceBefore;\n    if (_received < _params.minAmountOut) revert TooLittleReceived(_params.minAmountOut, _received);\n  }\n\n  // slither-disable-end reentrancy-balance\n\n  /**\n   * @notice Executes a forward-ordered exact-output V2 route through stable and volatile pools.\n   * @dev Each hop's required input is quoted backwards from the exact output by the pool itself, which applies its\n   *      own curve and total contextual fee, so both stable and volatile pools are supported. All hops are quoted\n   *      upfront; if an earlier hop increases a later hop's fee, that hop is underfunded and the route reverts.\n   *      The final recipient's balance delta must cover the exact requested output, so nonstandard output tokens that\n   *      under-deliver revert.\n   * @param _input ABI-encoded `SwapExactOutParams`.\n   */\n  // slither-disable-start reentrancy-balance\n  function _v2SwapExactOut(bytes calldata _input) internal {\n    SwapExactOutParams memory _params = abi.decode(_input, (SwapExactOutParams));\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, false, _params.recipient);\n    uint256 _length = _params.pools.length;\n    address _tokenOut = _tokens[_length];\n\n    // If the final recipient is the Metarouter, track the output token.\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_tokenOut);\n\n    // Quote each hop's required input backwards from the exact output.\n    uint256[] memory _amounts = new uint256[](_length + 1);\n    _amounts[_length] = _params.amountOut;\n    for (uint256 _i = _length; _i > 0;) {\n      --_i;\n      // The pool quotes the exact input its curve and total fee require for this hop's output.\n      _amounts[_i] = IPool(_params.pools[_i]).getAmountInWithTotalFee(_amounts[_i + 1], _tokens[_i + 1]);\n    }\n\n    // Reverts if the route requires more input than the authorized maximum.\n    if (_amounts[0] > _params.maxAmountIn) revert TooMuchRequested();\n\n    // The payer sends the quoted input straight to the first pool.\n    address _payer = _params.payerIsUser ? MetarouterState.msgSender() : address(this);\n    // Track custody-funded inputs so any unspent residual is swept back at batch closure.\n    if (!_params.payerIsUser) MetarouterState.trackERC20(_params.tokenIn);\n    FundsLib.pay(_params.tokenIn, _payer, _params.pools[0], _amounts[0]);\n\n    uint256 _balanceBefore = 0;\n\n    // Execute the swaps route.\n    for (uint256 _i; _i < _length; ++_i) {\n      // Route intermediate output to the next pool and final output to the recipient after snapshotting its balance.\n      address _recipient;\n      if (_i + 1 < _length) {\n        _recipient = _params.pools[_i + 1];\n      } else {\n        _recipient = _params.recipient;\n        // Snapshot immediately before the final swap so earlier route inflows cannot inflate the received amount.\n        _balanceBefore = IERC20(_tokenOut).balanceOf(_recipient);\n      }\n      _v2Swap(_params.pools[_i], _zeroForOne[_i], _amounts[_i + 1], _recipient);\n    }\n\n    // Reverts if the recipient did not receive the exact requested output.\n    uint256 _received = IERC20(_tokenOut).balanceOf(_params.recipient) - _balanceBefore;\n    if (_received < _params.amountOut) revert TooLittleReceived(_params.amountOut, _received);\n  }\n\n  // slither-disable-end reentrancy-balance\n\n  /**\n   * @notice Executes a V2 pool swap using the precomputed output amount.\n   * @param _pool Pool to execute against.\n   * @param _zeroForOne Whether token0 is exchanged for token1.\n   * @param _amountOut Output amount requested from the pool.\n   * @param _recipient Address that receives the output.\n   */\n  function _v2Swap(address _pool, bool _zeroForOne, uint256 _amountOut, address _recipient) internal {\n    (uint256 _amount0Out, uint256 _amount1Out) = _zeroForOne ? (uint256(0), _amountOut) : (_amountOut, uint256(0));\n    IPool(_pool).swap(_amount0Out, _amount1Out, _recipient, '');\n  }\n\n  /**\n   * @notice Executes a CL pool swap with the pool authorized as the only callback caller.\n   * @dev Arms the callback slot for the pool, swaps, and requires the pool to have consumed the authorization by\n   *      paying through the callback.\n   * @param _pool Pool to execute against.\n   * @param _zeroForOne Whether token0 is exchanged for token1.\n   * @param _amountSpecified Exact input amount, or negated exact output amount.\n   * @param _recipient Address that receives the output.\n   * @param _data Callback payment authorization forwarded to the pool.\n   * @return _amount0 Signed token0 balance change of the pool.\n   * @return _amount1 Signed token1 balance change of the pool.\n   */\n  function _clSwap(\n    address _pool,\n    bool _zeroForOne,\n    int256 _amountSpecified,\n    address _recipient,\n    bytes memory _data\n  ) internal returns (int256 _amount0, int256 _amount1) {\n    // Check the callback caller slot is empty, and then set the pool as the only accepted one.\n    address _current = address(uint160(TransientTracking.load(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT)));\n    if (_current != address(0)) revert CallbackNotCleared(_current);\n    TransientTracking.store(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT, uint256(uint160(_pool)));\n\n    // Selling token0 moves the price down and selling token1 up, so the boundary acts as no price limit at this point.\n    uint160 _sqrtRatioX96 = _zeroForOne ? _MIN_SQRT_RATIO_PLUS_ONE : _MAX_SQRT_RATIO_MINUS_ONE;\n    // Execute the swap.\n    (_amount0, _amount1) = ICLPool(_pool).swap(_recipient, _zeroForOne, _amountSpecified, _sqrtRatioX96, _data);\n\n    // The pool must consume its authorization by paying through the callback.\n    if (TransientTracking.load(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT) != 0) revert CallbackNotCleared(_pool);\n  }\n\n  // ============================== Control Flow ==============================\n\n  /**\n   * @notice Runs a nested command list in a call frame whose failure can be caught.\n   * @param _input ABI-encoded sub-plan commands and inputs.\n   */\n  function _executeSubPlan(bytes calldata _input) internal virtual {\n    (bytes memory _subCommands, bytes[] memory _subInputs) = abi.decode(_input, (bytes, bytes[]));\n    try this.execute(_subCommands, _subInputs, type(uint256).max) {}\n    catch (bytes memory _output) {\n      _revert(_output);\n    }\n  }\n\n  /**\n   * @notice Checks a forward-ordered pool route and its recipient, and resolves its token sequence and directions.\n   * @param _pools Pools in the route.\n   * @param _tokenIn Input token for the first pool.\n   * @param _clRoute Whether the route must consist of CL pools instead of V2 pools.\n   * @param _recipient Address that receives the route's final output.\n   * @return _tokens Route tokens, including the initial input and final output tokens.\n   * @return _zeroForOne Whether token0 is exchanged for token1 for each pool.\n   */\n  function _checkAndResolveRoute(\n    address[] memory _pools,\n    address _tokenIn,\n    bool _clRoute,\n    address _recipient\n  ) internal view returns (address[] memory _tokens, bool[] memory _zeroForOne) {\n    if (_recipient == address(0)) revert InvalidRecipient();\n    uint256 _length = _pools.length;\n    if (_length == 0) revert InvalidPath();\n    _tokens = new address[](_length + 1);\n    _zeroForOne = new bool[](_length);\n    _tokens[0] = _tokenIn;\n\n    for (uint256 _i; _i < _length; ++_i) {\n      address _pool = _pools[_i];\n      // Resolve the permanent creation record so existing pools remain usable if their factory is later unapproved.\n      address _factory = FACTORY_REGISTRY.targetToFactory(_pool);\n      if (_factory == address(0)) revert InvalidPool(_pool);\n      if (!IPoolFactory(_factory).isPool(_pool)) revert InvalidPool(_pool);\n      // V2 and CL pool interfaces share the same POOL_TYPE() getter signature and return type.\n      bytes32 _poolType = IPool(_pool).POOL_TYPE();\n      // Reject any pool outside the route's family.\n      if (_clRoute) {\n        if (_poolType != _CL_POOL_TYPE) revert InvalidPool(_pool);\n      } else if (_poolType != _V2_VOLATILE_POOL_TYPE && _poolType != _V2_STABLE_POOL_TYPE) {\n        revert InvalidPool(_pool);\n      }\n\n      // Check which one of token0 or token1 is the input token.\n      (address _token0, address _token1) = (IPool(_pool).token0(), IPool(_pool).token1());\n      bool _isZeroForOne = _tokens[_i] == _token0;\n      if (!_isZeroForOne && _tokens[_i] != _token1) revert InvalidPath();\n      _zeroForOne[_i] = _isZeroForOne;\n\n      // Derive this hop's output token, which becomes the next hop's input.\n      _tokens[_i + 1] = _isZeroForOne ? _token1 : _token0;\n    }\n  }\n\n  /**\n   * @notice Rejects delegatecalls: the router re-enters itself by address, so it must run at its deployment address.\n   * @dev Sub-plans and allow-revert commands re-enter via `address(this).call(execute)`. Under a delegatecall\n   *      `address(this)` is not Metarouter, which implies `execute()` may not be available, so an allow-revert\n   *      command would silently no-op. Fail fast instead.\n   */\n  function _checkExecutionContext() internal view virtual {\n    if (address(this) != _IMPLEMENTATION) revert DirectCallRequired();\n  }\n\n  /**\n   * @notice Balance assertion whose failure can be handled with ALLOW_REVERT.\n   * @dev Address zero selects native ETH. For the execution address, a balance means only what is available to the\n   *      active batch: native ETH excludes what was held before the batch began, and the native ERC20 — whose\n   *      `balanceOf` is the native balance — applies the same exclusion. Other owners use their live account balance.\n   * @param _input ABI-encoded asset, owner, and minimum balance.\n   */\n  function _balanceCheck(bytes calldata _input) internal view virtual {\n    (address _asset, address _owner, uint256 _minBalance) = abi.decode(_input, (address, address, uint256));\n    uint256 _balance;\n    if (_asset == address(0)) {\n      _balance = _owner == address(this) ? MetarouterState.availableNativeBalance() : _owner.balance;\n    } else {\n      _balance =\n        _owner == address(this) ? MetarouterState.availableErc20Balance(_asset) : IERC20(_asset).balanceOf(_owner);\n    }\n    if (_balance < _minBalance) revert InsufficientBalance(_asset);\n  }\n\n  /**\n   * @notice Splits a command byte into its command ID and allow-revert flag.\n   * @param _commandByte Encoded command ID and flags.\n   * @return _commandType Command ID with flags removed.\n   * @return _allowRevert Whether failure of the command may be ignored.\n   */\n  function _decode(bytes1 _commandByte) internal pure virtual returns (uint256 _commandType, bool _allowRevert) {\n    _commandType = uint256(uint8(_commandByte & Commands.COMMAND_TYPE_MASK));\n    _allowRevert = _commandByte & Commands.FLAG_ALLOW_REVERT != 0;\n  }\n\n  /**\n   * @notice Bubbles revert data returned by a failed child frame.\n   * @param _output Raw revert data to re-throw.\n   */\n  function _revert(bytes memory _output) private pure {\n    assembly ('memory-safe') {\n      revert(add(_output, 0x20), mload(_output))\n    }\n  }\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    /**\n     * @dev An operation with an ERC-20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        if (!_safeTransfer(token, to, value, true)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        if (!_safeTransferFrom(token, from, to, value, true)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n        return _safeTransfer(token, to, value, false);\n    }\n\n    /**\n     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n        return _safeTransferFrom(token, from, to, value, false);\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     *\n     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n     * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n     * set here.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        if (!_safeApprove(token, spender, value, false)) {\n            if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));\n            if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            safeTransfer(token, to, value);\n        } else if (!token.transferAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n     * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferFromAndCallRelaxed(\n        IERC1363 token,\n        address from,\n        address to,\n        uint256 value,\n        bytes memory data\n    ) internal {\n        if (to.code.length == 0) {\n            safeTransferFrom(token, from, to, value);\n        } else if (!token.transferFromAndCall(from, to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n     * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n     * once without retrying, and relies on the returned value to be true.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            forceApprove(token, to, value);\n        } else if (!token.approveAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n     * return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param to The recipient of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {\n        bytes4 selector = IERC20.transfer.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(to, shr(96, not(0))))\n            mstore(0x24, value)\n            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n     * value: the return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param from The sender of the tokens\n     * @param to The recipient of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value,\n        bool bubble\n    ) private returns (bool success) {\n        bytes4 selector = IERC20.transferFrom.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(from, shr(96, not(0))))\n            mstore(0x24, and(to, shr(96, not(0))))\n            mstore(0x44, value)\n            success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n            mstore(0x60, 0)\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n     * the return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param spender The spender of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {\n        bytes4 selector = IERC20.approve.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(spender, shr(96, not(0))))\n            mstore(0x24, value)\n            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n        }\n    }\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC-721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n     *   {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the address zero.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity >=0.5.0;\n\n/**\n * @title ERC-721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC-721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n     * reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"},"V3/src/metarouter/TransientTracking.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\n/**\n * @title TransientTracking\n * @notice Transient scalar, array, and mapping-like storage used during execution.\n * @dev All functions are internal, so they inline into the caller and tload/tstore operate\n *      on the calling contract's transient storage. Mapping values use\n *      `keccak256(abi.encode(key, namespace))`; Solidity does not support transient mappings.\n */\nlibrary TransientTracking {\n  /**\n   * @notice Stores a value in a transient slot.\n   * @param _slot Transient slot to write.\n   * @param _value Value to store.\n   */\n  function store(bytes32 _slot, uint256 _value) internal {\n    assembly {\n      tstore(_slot, _value)\n    }\n  }\n\n  /**\n   * @notice Stores a mapping-like transient value for `_key` under `_namespace`.\n   * @param _namespace Namespace used to derive the transient mapping slot.\n   * @param _key Address key whose value is written.\n   * @param _value Value to store for the key.\n   */\n  function storeMapping(bytes32 _namespace, address _key, uint256 _value) internal {\n    assembly {\n      mstore(0x00, _key)\n      mstore(0x20, _namespace)\n      tstore(keccak256(0x00, 0x40), _value)\n    }\n  }\n\n  /**\n   * @notice Adds `_key` to a transient array once per batch.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _namespace Namespace holding the transient deduplication flags.\n   * @param _key Address to track.\n   */\n  function track(bytes32 _arraySlot, bytes32 _namespace, address _key) internal {\n    if (loadMapping(_namespace, _key) != 0) return;\n    storeMapping(_namespace, _key, 1);\n    push(_arraySlot, _key);\n  }\n\n  /**\n   * @notice Appends an address to a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _value Address to append.\n   */\n  function push(bytes32 _arraySlot, address _value) internal {\n    uint256 _length = length(_arraySlot);\n    bytes32 _slot = _elementSlot(_arraySlot, _length);\n    assembly {\n      tstore(_slot, _value)\n    }\n    store(_arraySlot, _length + 1);\n  }\n\n  /**\n   * @notice Appends a `uint256` to a transient array.\n   * @dev Companion to `push` for full-width values such as NFT token IDs, index-aligned with a paired address array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _value Value to append.\n   */\n  function pushUint(bytes32 _arraySlot, uint256 _value) internal {\n    uint256 _length = length(_arraySlot);\n    bytes32 _slot = _elementSlot(_arraySlot, _length);\n    assembly {\n      tstore(_slot, _value)\n    }\n    store(_arraySlot, _length + 1);\n  }\n\n  /**\n   * @notice Resets a transient array for reuse in the same transaction.\n   * @dev Element slots are overwritten when reused and need not be cleared individually.\n   * @param _arraySlot Slot storing the transient array length.\n   */\n  function clear(bytes32 _arraySlot) internal {\n    store(_arraySlot, 0);\n  }\n\n  /**\n   * @notice Clears a transient tracked-address flag.\n   * @dev Transient storage is transaction-scoped, so flags must be cleared between batches in one transaction.\n   * @param _namespace Namespace holding the transient deduplication flag.\n   * @param _key Address whose flag is cleared.\n   */\n  function untrack(bytes32 _namespace, address _key) internal {\n    storeMapping(_namespace, _key, 0);\n  }\n\n  /**\n   * @notice Returns the length of a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @return _length Number of elements in the array.\n   */\n  function length(bytes32 _arraySlot) internal view returns (uint256 _length) {\n    return load(_arraySlot);\n  }\n\n  /**\n   * @notice Returns an address from a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _index Element index to read.\n   * @return _value Address stored at the index.\n   */\n  function at(bytes32 _arraySlot, uint256 _index) internal view returns (address _value) {\n    bytes32 _slot = _elementSlot(_arraySlot, _index);\n    assembly {\n      _value := tload(_slot)\n    }\n  }\n\n  /**\n   * @notice Returns a `uint256` from a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _index Element index to read.\n   * @return _value Value stored at the index.\n   */\n  function atUint(bytes32 _arraySlot, uint256 _index) internal view returns (uint256 _value) {\n    bytes32 _slot = _elementSlot(_arraySlot, _index);\n    assembly {\n      _value := tload(_slot)\n    }\n  }\n\n  /**\n   * @notice Loads a value from a transient slot.\n   * @param _slot Transient slot to read.\n   * @return _value Value stored in the slot.\n   */\n  function load(bytes32 _slot) internal view returns (uint256 _value) {\n    assembly {\n      _value := tload(_slot)\n    }\n  }\n\n  /**\n   * @notice Loads the mapping-like transient value for `_key` under `_namespace`.\n   * @param _namespace Namespace used to derive the transient mapping slot.\n   * @param _key Address key whose value is read.\n   * @return _value Value stored for the key.\n   */\n  function loadMapping(bytes32 _namespace, address _key) internal view returns (uint256 _value) {\n    assembly {\n      mstore(0x00, _key)\n      mstore(0x20, _namespace)\n      _value := tload(keccak256(0x00, 0x40))\n    }\n  }\n\n  /**\n   * @notice Derives the slot of an element using Solidity's dynamic-array layout.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _index Element index whose slot is derived.\n   * @return _slot Transient slot holding the element.\n   */\n  function _elementSlot(bytes32 _arraySlot, uint256 _index) private pure returns (bytes32 _slot) {\n    return bytes32(uint256(keccak256(abi.encode(_arraySlot))) + _index);\n  }\n}\n"},"V3/src/metarouter/libraries/ClPositionLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nimport {ClResolverLib} from 'V3/metarouter/libraries/ClResolverLib.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {INonfungiblePositionManager} from 'V3/interfaces/external/INonfungiblePositionManager.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title ClPositionLib\n * @notice Concentrated-liquidity position command handlers for the Metarouter: mint, increase, decrease, collect, and\n *         burn.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode but runs in its storage context. Funding, custody tracking, sender resolution, and\n *      the in-flight NFT slots go through `MetarouterState` / `FundsLib`; the registry is passed in because a library\n *      cannot read the router's immutables.\n *\n *      Every handler names a CL factory in its calldata and resolves that factory's position manager once, through\n *      `ClResolverLib`, so the router holds no canonical manager and each authenticated factory operates its own\n *      collection. Resolving once per command also keeps a single command from acting on two different managers, which\n *      a factory returning inconsistent values could otherwise cause.\n *\n *      `MINT_CL_POSITION` mints to the execution address and stores the new position in the in-flight slots so a later\n *      command (increase, stake, or burn) can act on it without knowing its id; the mint also tracks the position\n *      for custody so closure verifies it left even when nothing consumes it. The manager mints with `_mint`, not\n *      `_safeMint`, so the receiver hook does not fire and the handler tracks the position itself.\n *\n *      Operations on an existing position resolve the id (the zero sentinel maps to the in-flight position of the\n *      named collection), then check the caller may operate it: the router may act on a position it holds only when\n *      custody tracking proves it entered during the batch, and otherwise only on the logical sender's own position,\n *      never a third party's. Because custody, in-flight, and tracking state are all keyed by `(collection, tokenId)`,\n *      a position produced under one factory cannot be consumed by a command naming another, even when both managers\n *      issued the same id.\n */\nlibrary ClPositionLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Mints a new CL position to a chosen recipient, or the metarouter itself to keep it for a later command.\n   * @dev Funds both pool tokens, approves the manager, mints, and clears the approvals; the manager pulls only what it\n   *      uses, so any remainder is swept at closure. Only a position minted to the metarouter is tracked for custody\n   *      and put in flight; one minted to another recipient never enters the router and is left untracked.\n   * @param _input ABI-encoded `MintClParams`.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function mintClPosition(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.MintClParams memory _params = abi.decode(_input, (IMetarouter.MintClParams));\n\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // A nonzero initial price tells the manager to create a pool; existing-pool mints use zero.\n    if (_params.sqrtPriceX96 != 0 && !_factoryRegistry.isTargetFactoryApproved(_params.factory)) {\n      revert IMetarouter.FactoryNotApproved();\n    }\n\n    INonfungiblePositionManager _positionManager =\n      ClResolverLib.resolvePositionManager(_params.factory, _factoryRegistry);\n\n    uint256 _amount0 = FundsLib.fund(_params.token0, _params.spend0, _params.payerIsUser0);\n    uint256 _amount1 = FundsLib.fund(_params.token1, _params.spend1, _params.payerIsUser1);\n\n    IERC20(_params.token0).forceApprove(address(_positionManager), _amount0);\n    IERC20(_params.token1).forceApprove(address(_positionManager), _amount1);\n\n    // slither-disable-next-line unused-return\n    (uint256 _tokenId,,,) = _positionManager.mint(\n      INonfungiblePositionManager.MintParams({\n        token0: _params.token0,\n        token1: _params.token1,\n        tickSpacing: _params.tickSpacing,\n        tickLower: _params.tickLower,\n        tickUpper: _params.tickUpper,\n        amount0Desired: _amount0,\n        amount1Desired: _amount1,\n        amount0Min: _params.amount0Min,\n        amount1Min: _params.amount1Min,\n        recipient: _params.recipient,\n        deadline: _params.deadline,\n        sqrtPriceX96: _params.sqrtPriceX96\n      })\n    );\n\n    // Held by the router: a later command stakes or burns it, and closure verifies it left. Recorded before the\n    // allowance-clearing interactions below, so the custody effect precedes them.\n    if (_params.recipient == address(this)) {\n      MetarouterState.trackNft(address(_positionManager), _tokenId);\n      MetarouterState.setInFlightNft(address(_positionManager), _tokenId);\n    }\n\n    // The manager pulls only what the mint used; clear the residual allowance it leaves.\n    IERC20(_params.token0).forceApprove(address(_positionManager), 0);\n    IERC20(_params.token1).forceApprove(address(_positionManager), 0);\n  }\n\n  /**\n   * @notice Adds liquidity to an existing position, funded from the batch balance or the logical sender.\n   * @dev Resolves the position (the zero sentinel maps to the in-flight one), reads its pool tokens, funds each, and\n   *      increases. Ownership is deliberately not checked: adding liquidity cannot harm the position's owner, and the\n   *      manager gates the caller only for a gauge-staked position (letting just the owning gauge increase it), so any\n   *      other position may be topped up while a staked one reverts. A position parked in the router is still refused,\n   *      since operating one is how a batch would reach a position it never took custody of. The manager pulls only the\n   *      used amounts, so any funded remainder stays tracked and is swept at closure; the temporary approvals are\n   *      cleared after. The position stays available, so the in-flight slots are left untouched.\n   * @param _input ABI-encoded `IncreaseClParams`.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function increaseClLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.IncreaseClParams memory _params = abi.decode(_input, (IMetarouter.IncreaseClParams));\n\n    INonfungiblePositionManager _positionManager =\n      ClResolverLib.resolvePositionManager(_params.factory, _factoryRegistry);\n\n    uint256 _tokenId = MetarouterState.resolvePositionId(address(_positionManager), _params.tokenId);\n    // The router owns anything parked in it, so the manager's own authorization would wave such a position through;\n    // only the batch's custody tracking separates one this batch took from one stranded here earlier.\n    if (_positionManager.ownerOf(_tokenId) == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_positionManager), _tokenId)) revert IMetarouter.NftNotInCustody();\n    }\n\n    // slither-disable-next-line unused-return\n    (,, address _token0, address _token1,,,,,,,,) = _positionManager.positions(_tokenId);\n\n    uint256 _amount0 = FundsLib.fund(_token0, _params.spend0, _params.payerIsUser0);\n    uint256 _amount1 = FundsLib.fund(_token1, _params.spend1, _params.payerIsUser1);\n\n    IERC20(_token0).forceApprove(address(_positionManager), _amount0);\n    IERC20(_token1).forceApprove(address(_positionManager), _amount1);\n\n    // slither-disable-next-line unused-return\n    _positionManager.increaseLiquidity(\n      INonfungiblePositionManager.IncreaseLiquidityParams({\n        tokenId: _tokenId,\n        amount0Desired: _amount0,\n        amount1Desired: _amount1,\n        amount0Min: _params.amount0Min,\n        amount1Min: _params.amount1Min,\n        deadline: _params.deadline\n      })\n    );\n\n    // The manager pulls only what the increase used; clear the residual allowance it leaves.\n    IERC20(_token0).forceApprove(address(_positionManager), 0);\n    IERC20(_token1).forceApprove(address(_positionManager), 0);\n  }\n\n  /**\n   * @notice Removes liquidity from an existing position into its owed-token balance.\n   * @dev Resolves the position and checks the caller may operate it, then decreases. The manager accounts the removed\n   *      liquidity to the position's owed tokens without transferring anything out, so a later `COLLECT_CL_FEES`\n   *      extracts it; nothing is tracked here. When all liquidity is requested, its live value is read immediately\n   *      before the decrease so a third-party increase cannot leave residue, and an already-empty position is a\n   *      no-op so a remove-everything plan cannot abort on it. The position stays available, so the in-flight slots\n   *      are left untouched.\n   * @param _input ABI-encoded `(address factory, INonfungiblePositionManager.DecreaseLiquidityParams,\n   *        bool decreaseAllLiquidity)`; `tokenId` zero uses the in-flight position.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function decreaseClLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _factory, INonfungiblePositionManager.DecreaseLiquidityParams memory _params, bool _decreaseAllLiquidity) =\n      abi.decode(_input, (address, INonfungiblePositionManager.DecreaseLiquidityParams, bool));\n\n    INonfungiblePositionManager _positionManager = ClResolverLib.resolvePositionManager(_factory, _factoryRegistry);\n\n    _params.tokenId = MetarouterState.resolvePositionId(address(_positionManager), _params.tokenId);\n    _requireOperable(_positionManager, _params.tokenId);\n\n    if (_decreaseAllLiquidity) {\n      // slither-disable-next-line unused-return\n      (,,,,,,, uint128 _currentLiquidity,,,,) = _positionManager.positions(_params.tokenId);\n      // An already empty position has nothing to remove and the manager rejects a zero decrease, so skip it as a\n      // no-op instead of aborting a batch containing a remove everything command whose liquidity is already gone.\n      if (_currentLiquidity == 0) return;\n      _params.liquidity = _currentLiquidity;\n    }\n\n    // slither-disable-next-line unused-return\n    _positionManager.decreaseLiquidity(_params);\n  }\n\n  /**\n   * @notice Collects a position's owed tokens to a recipient, or the metarouter to keep them for the batch.\n   * @dev Resolves the position and checks the caller may operate it, then collects. Collecting to the metarouter tracks\n   *      the pool tokens so a later command can consume them and closure returns any leftover; any other recipient\n   *      receives them directly, untracked. The position stays available, so the in-flight slots are left untouched.\n   * @param _input ABI-encoded `(address factory, INonfungiblePositionManager.CollectParams)`; `tokenId` zero uses the\n   *        in-flight position, and `recipient` must be non-zero.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function collectClFees(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _factory, INonfungiblePositionManager.CollectParams memory _params) =\n      abi.decode(_input, (address, INonfungiblePositionManager.CollectParams));\n\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    INonfungiblePositionManager _positionManager = ClResolverLib.resolvePositionManager(_factory, _factoryRegistry);\n\n    _params.tokenId = MetarouterState.resolvePositionId(address(_positionManager), _params.tokenId);\n    _requireOperable(_positionManager, _params.tokenId);\n\n    // A collect into the router tracks the pool tokens so closure returns any leftover.\n    if (_params.recipient == address(this)) {\n      // slither-disable-next-line unused-return\n      (,, address _token0, address _token1,,,,,,,,) = _positionManager.positions(_params.tokenId);\n      MetarouterState.trackERC20(_token0);\n      MetarouterState.trackERC20(_token1);\n    }\n\n    // slither-disable-next-line unused-return\n    _positionManager.collect(_params);\n  }\n\n  /**\n   * @notice Burns an empty position and drops it from custody and the in-flight slots.\n   * @dev Resolves the position and checks the caller may operate it, then burns. The manager requires the position to\n   *      hold no liquidity and no owed tokens. The burned id is untracked so the closure ownership check skips it rather\n   *      than reading a nonexistent token, and cleared from the in-flight slots when it was the in-flight position.\n   * @param _input ABI-encoded `(address factory, uint256 tokenId)`; `tokenId` zero uses the in-flight position.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function burnClPosition(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _factory, uint256 _tokenId) = abi.decode(_input, (address, uint256));\n\n    INonfungiblePositionManager _positionManager = ClResolverLib.resolvePositionManager(_factory, _factoryRegistry);\n\n    _tokenId = MetarouterState.resolvePositionId(address(_positionManager), _tokenId);\n    _requireOperable(_positionManager, _tokenId);\n\n    _positionManager.burn(_tokenId);\n\n    MetarouterState.untrackNft(address(_positionManager), _tokenId);\n    MetarouterState.consumeInFlightNft(address(_positionManager), _tokenId);\n  }\n\n  /**\n   * @notice Reverts unless the logical sender may operate the position.\n   * @dev A router-held position must have entered custody during the batch, proven by its tracking, so a command cannot\n   *      operate a position stranded before the batch. Any other holder must be the logical sender; the router never\n   *      operates a third party's position.\n   * @param _positionManager Position manager holding the position.\n   * @param _tokenId Position to check.\n   */\n  function _requireOperable(INonfungiblePositionManager _positionManager, uint256 _tokenId) private view {\n    address _owner = _positionManager.ownerOf(_tokenId);\n    if (_owner == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_positionManager), _tokenId)) revert IMetarouter.NftNotInCustody();\n    } else if (_owner != MetarouterState.msgSender()) {\n      revert IMetarouter.NotPositionOwner();\n    }\n  }\n}\n"},"V3/src/metarouter/libraries/ClaimsLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {GaugeLib} from 'V3/metarouter/libraries/GaugeLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {V2PoolLib} from 'V3/metarouter/libraries/V2PoolLib.sol';\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {ICLGauge} from 'V3/interfaces/gauges/ICLGauge.sol';\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title ClaimsLib\n * @notice Reward-claim command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode while executing in the router's storage context. Tracking and logical-sender\n *      resolution go through `FundsLib`; the Voter is passed in because a library cannot read the router's immutables.\n */\nlibrary ClaimsLib {\n  /**\n   * @notice Claims the logical sender's gauge emissions.\n   * @dev The gauge enforces caller authorization; the account is fixed to the logical sender. An empty position-id\n   *      list selects the account-level overload, including for CL gauges, and can therefore iterate the account's\n   *      entire staked-position set. A non-empty list is accepted only for CL gauges and bounds their internal\n   *      iteration to the caller-supplied positions. A gauge claim delivers one emission token per chain (the\n   *      `ReceiptToken` on leaf, the canonical `TOKEN` on root), so when routed to the router that single token is\n   *      tracked for the closure sweep. The token is passed in because the router holds it as an immutable and no\n   *      reachable contract exposes it uniformly across chains. A V2 gauge slashes the account's full accrual while\n   *      the early-unstake penalty window is live, so the claim then requires the explicit `allowPenalty` consent;\n   *      a CL gauge slashes only newly accrued rewards and skips the check.\n   *\n   *      On root, `RootEmissionsHandler` saves rewards below the redeem minimum for each recipient. If the recipient\n   *      is the router, small rewards from different users accumulate together. The user whose batch reaches the\n   *      minimum receives the total, including less than 1e-12 TOKEN from earlier users. Claim directly to the user's\n   *      address to keep these rewards separate.\n   * @param _input ABI-encoded gauge, recipient, optional CL position ids, and whether an active V2 penalty is allowed;\n   *        an empty position list claims account-wide.\n   * @param _leafVoter Leaf Voter used to validate the gauge target.\n   * @param _emissionToken Token the gauge claim delivers on this chain, tracked when the router is the recipient.\n   * @param _factoryRegistry Registry holding the gauge's permanent deploying-factory record.\n   */\n  function claimGaugeRewards(\n    bytes calldata _input,\n    ILeafVoter _leafVoter,\n    IERC20 _emissionToken,\n    IFactoryRegistry _factoryRegistry\n  ) external {\n    (address _gauge, address _recipient, uint256[] memory _tokenIds, bool _allowPenalty) =\n      abi.decode(_input, (address, address, uint256[], bool));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    GaugeLib.requireRegisteredGauge(_gauge, _leafVoter);\n\n    if (_recipient == address(this)) MetarouterState.trackERC20(address(_emissionToken));\n\n    address _account = MetarouterState.msgSender();\n    // slither-disable-next-line unused-return\n    (bool _isCl,) = GaugeLib.isClGauge(_gauge, _factoryRegistry);\n    if (_isCl) {\n      if (_tokenIds.length == 0) IGauge(_gauge).claimEmissions(_account, _recipient);\n      else ICLGauge(_gauge).claimEmissions(_account, _recipient, _tokenIds);\n    } else {\n      if (_tokenIds.length > 0) revert IMetarouter.InvalidGaugeType();\n      GaugeLib.requirePenaltyAllowed(_gauge, _account, _allowPenalty);\n      IGauge(_gauge).claimEmissions(_account, _recipient);\n    }\n  }\n\n  /**\n   * @notice Claims V2 pool fees for the caller or the router.\n   * @dev Validates the pool through its permanent creation record, factory membership, and V2 pool family,\n   *      so existing pools remain usable after their factory is unapproved. User claims need approval from the caller.\n   *      `claimRouterFees` selects fees earned while the router held LP tokens. Anyone can claim these, as with\n   *      `SWEEP`. Tokens sent to the router are tracked for later commands and swept at batch end.\n   * @param _input ABI-encoded `(pool, recipient, claimRouterFees)`.\n   * @param _factoryRegistry Registry used to validate the pool.\n   */\n  function claimV2PoolFees(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _pool, address _recipient, bool _claimRouterFees) = abi.decode(_input, (address, address, bool));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // slither-disable-next-line unused-return\n    V2PoolLib.validatePool(_pool, _factoryRegistry);\n\n    if (_recipient == address(this)) {\n      MetarouterState.trackERC20(IPool(_pool).token0());\n      MetarouterState.trackERC20(IPool(_pool).token1());\n    }\n\n    // The pool sees the router as the caller.\n    // slither-disable-start unused-return\n    if (_claimRouterFees) IPool(_pool).claimFees(_recipient);\n    else IPool(_pool).claimFees({_account: MetarouterState.msgSender(), _recipient: _recipient});\n    // slither-disable-end unused-return\n  }\n}\n"},"V3/src/metarouter/libraries/Commands.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\n/**\n * @title Commands\n * @notice Command IDs and command-byte encoding constants used by the Metarouter.\n */\nlibrary Commands {\n  /// Payments\n  /**\n   * @notice Transfers a full execution-address balance with a minimum floor.\n   * @return The SWEEP command ID.\n   */\n  uint256 public constant SWEEP = 0x04;\n\n  /**\n   * @notice Transfers a balance portion selected with `Amount` or `Pips` to a recipient.\n   * @return The TRANSFER command ID.\n   */\n  uint256 public constant TRANSFER = 0x05;\n\n  /**\n   * @notice Wraps an `Amount` or `Pips` portion of the available native ETH.\n   * @return The WRAP_ETH command ID.\n   */\n  uint256 public constant WRAP_ETH = 0x0b;\n\n  /**\n   * @notice Unwraps a WETH balance portion selected with `Amount` or `Pips` and sends ETH to a recipient.\n   * @return The UNWRAP_WETH command ID.\n   */\n  uint256 public constant UNWRAP_WETH = 0x0c;\n\n  /**\n   * @notice Pulls an `Amount` or `Pips` share of `msgSender()`'s balance into the execution address.\n   * @return The FUND_ERC20 command ID.\n   */\n  uint256 public constant FUND_ERC20 = 0x0f;\n\n  /**\n   * @notice Transfers an NFT held in batch custody to a recipient.\n   * @dev Sits at the tail of the ID sequence because new IDs extend it; it belongs to this group.\n   * @return The TRANSFER_NFT command ID.\n   */\n  uint256 public constant TRANSFER_NFT = 0x34;\n\n  /// Swaps\n  /**\n   * @notice Executes an exact-input CL swap.\n   * @return The CL_SWAP_EXACT_IN command ID.\n   */\n  uint256 public constant CL_SWAP_EXACT_IN = 0x00;\n\n  /**\n   * @notice Executes an exact-output CL swap.\n   * @return The CL_SWAP_EXACT_OUT command ID.\n   */\n  uint256 public constant CL_SWAP_EXACT_OUT = 0x01;\n\n  /**\n   * @notice Executes an exact-input V2 swap.\n   * @return The V2_SWAP_EXACT_IN command ID.\n   */\n  uint256 public constant V2_SWAP_EXACT_IN = 0x08;\n\n  /**\n   * @notice Executes an exact-output V2 swap.\n   * @return The V2_SWAP_EXACT_OUT command ID.\n   */\n  uint256 public constant V2_SWAP_EXACT_OUT = 0x09;\n\n  /// V2 liquidity\n  /**\n   * @notice Adds liquidity and mints LP tokens.\n   * @return The ADD_LIQUIDITY command ID.\n   */\n  uint256 public constant ADD_LIQUIDITY = 0x22;\n\n  /**\n   * @notice Burns LP tokens for the underlying assets.\n   * @return The REMOVE_LIQUIDITY command ID.\n   */\n  uint256 public constant REMOVE_LIQUIDITY = 0x23;\n\n  /// CL positions\n  /**\n   * @notice Mints a new CL position.\n   * @return The MINT_CL_POSITION command ID.\n   */\n  uint256 public constant MINT_CL_POSITION = 0x24;\n\n  /**\n   * @notice Adds liquidity to a position.\n   * @return The INCREASE_CL_LIQUIDITY command ID.\n   */\n  uint256 public constant INCREASE_CL_LIQUIDITY = 0x25;\n\n  /**\n   * @notice Removes liquidity from a position.\n   * @return The DECREASE_CL_LIQUIDITY command ID.\n   */\n  uint256 public constant DECREASE_CL_LIQUIDITY = 0x26;\n\n  /**\n   * @notice Collects tokens owed by a position.\n   * @return The COLLECT_CL_FEES command ID.\n   */\n  uint256 public constant COLLECT_CL_FEES = 0x27;\n\n  /**\n   * @notice Burns a CL position NFT after all liquidity and owed tokens have been removed.\n   * @return The BURN_CL_POSITION command ID.\n   */\n  uint256 public constant BURN_CL_POSITION = 0x28;\n\n  /// Staking\n  /**\n   * @notice Stakes an LP balance or CL position in a gauge.\n   * @return The STAKE_GAUGE command ID.\n   */\n  uint256 public constant STAKE_GAUGE = 0x29;\n\n  /**\n   * @notice Withdraws the caller's gauge stake.\n   * @return The UNSTAKE_GAUGE command ID.\n   */\n  uint256 public constant UNSTAKE_GAUGE = 0x2a;\n\n  /// Claims\n  /**\n   * @notice Claims the caller's gauge rewards.\n   * @return The CLAIM_GAUGE_REWARDS command ID.\n   */\n  uint256 public constant CLAIM_GAUGE_REWARDS = 0x2d;\n\n  /**\n   * @notice Claims V2 pool fees for the caller or the router.\n   * @return The CLAIM_V2_POOL_FEES command ID.\n   */\n  uint256 public constant CLAIM_V2_POOL_FEES = 0x2f;\n\n  /// Stake and relay\n  /**\n   * @notice Stakes TOKEN and creates an sAERO.\n   * @return The CREATE_STAKE command ID.\n   */\n  uint256 public constant CREATE_STAKE = 0x30;\n\n  /**\n   * @notice Deposits an existing sAERO into a relay.\n   * @return The DEPOSIT_RELAY command ID.\n   */\n  uint256 public constant DEPOSIT_RELAY = 0x32;\n\n  /// Cross-chain\n  /**\n   * @notice Bridges a supported token held by the execution address.\n   * @return The BRIDGE_TOKEN command ID.\n   */\n  uint256 public constant BRIDGE_TOKEN = 0x12;\n\n  /**\n   * @notice Dispatches a destination plan through ICA.\n   * @return The EXECUTE_CROSS_CHAIN command ID.\n   */\n  uint256 public constant EXECUTE_CROSS_CHAIN = 0x13;\n\n  /**\n   * @notice Burns held `ReceiptToken` on a leaf to mint `TOKEN` to a root recipient.\n   * @return The REDEEM command ID.\n   */\n  uint256 public constant REDEEM = 0x14;\n\n  /// Control flow\n  /**\n   * @notice Executes a catchable nested command list.\n   * @return The EXECUTE_SUB_PLAN command ID.\n   */\n  uint256 public constant EXECUTE_SUB_PLAN = 0x21;\n\n  /**\n   * @notice Reverts when an ERC20 or native balance is below a minimum.\n   * @dev Address zero selects native ETH.\n   * @return The BALANCE_CHECK command ID.\n   */\n  uint256 public constant BALANCE_CHECK = 0x0e;\n\n  /// Command-byte encoding\n  /**\n   * @notice High bit of a command byte; when set, marks the command as allow-revert.\n   * @dev The swallowed failure also covers a revert from an invalid or undefined command, not only a handler's\n   *      own failure.\n   * @return The allow-revert flag mask.\n   */\n  bytes1 public constant FLAG_ALLOW_REVERT = 0x80;\n\n  /**\n   * @notice Low seven bits of a command byte holding the command ID.\n   * @return The command-ID bit mask.\n   */\n  bytes1 public constant COMMAND_TYPE_MASK = 0x7f;\n}\n"},"V3/src/metarouter/libraries/CrosschainLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {Math} from '@openzeppelin/contracts/utils/math/Math.sol';\n\nimport {MAX_PIPS} from 'V3/libraries/ProtocolConstants.sol';\n\nimport {Commands} from 'V3/metarouter/libraries/Commands.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {TokenRouterLib} from 'V3/metarouter/libraries/TokenRouterLib.sol';\n\nimport {IInterchainAccountRouter} from 'V3/interfaces/external/IInterchainAccountRouter.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title CrosschainLib\n * @notice Cross-chain command handlers for the Metarouter: bridging a held token, dispatching a destination plan, and\n *         redeeming held `ReceiptToken` for `TOKEN` on root.\n */\nlibrary CrosschainLib {\n  using SafeERC20 for IERC20;\n\n  /// @notice Length of the hook metadata's fixed prefix, per `StandardHookMetadata`: `[0:2]` variant, `[2:34]`\n  ///         msgValue, `[34:66]` gasLimit, `[66:86]` refund address. Optional fields follow, so this is both the\n  ///         shortest metadata carrying a refund address and the offset of the first optional field.\n  uint256 private constant _HOOK_METADATA_PREFIX_LENGTH = 86;\n\n  /**\n   * @notice Bridges a selected token or native balance to the logical sender's destination interchain account, or to\n   *         a caller-chosen recipient.\n   * @dev `token == address(0)` selects native. Any other token selects ERC20. The Warp Route must report the same\n   *      token.\n   *\n   *      The selected amount is the total bridge budget, not the delivered amount. The quoted fee is deducted from\n   *      this budget, while `maxFee` limits the deduction. The cap carries its own mode, independent of the spend: an\n   *      `Amount` cap is an absolute token figure, a `Pips` cap a ceil-rounded fraction of the resolved bridge amount.\n   *      Fees quoted in `token` count toward the deduction; a nonzero fee quoted in another ERC20 reverts.\n   *\n   *      A zero `targetRouter` uses the source router's enrolled route for `domain`. A nonzero target selects the\n   *      cross-collateral quote and transfer and never falls back to that route. The recipient then receives the\n   *      target router's token, which may differ from `token`, converted by both routers' configured scale ratios.\n   *      Delivery needs the target to accept the source router, as its enrolled route or as a cross-collateral router\n   *      for this origin; otherwise the message stays undelivered, the collateral stays in the source router, and\n   *      nothing refunds it automatically. Explicit targets take ERC20 collateral to a remote domain only: on this\n   *      chain the transfer settles as a synchronous local swap, and a custom ICA configuration would fund an\n   *      interchain account on this same chain, which the ICA flow does not support.\n   *\n   *      Native bridges resolve the spend against the batch's available ETH and forward, as `msg.value`, the route's\n   *      quote for the reduced amount, which covers the delivered amount, fees and gas. Any budget left after that\n   *      quote stays in the batch and returns at closure, and a quote above the budget reverts. `messageFee` is\n   *      ignored. ERC20 bridges grant the Warp Route a temporary approval for the budget and forward `messageFee`\n   *      separately, bounded by the batch's own native. The chain's native ERC20 resolves its spend against the batch\n   *      native remaining after `messageFee`, since the pull and the fee draw from the same balance; a full-pips\n   *      spend therefore leaves the fee funded instead of double-committing it. The token is tracked so any amount\n   *      left in the Metarouter returns with the batch's other unused funds.\n   *\n   *      With a zero `recipient`, funds go to the ICA derived from the destination domain, logical sender, router and\n   *      ISM. An empty ICA configuration uses the enrolled router and ISM, while a custom configuration uses the\n   *      supplied values. This command and every later execution must use the same domain and configuration to reach\n   *      the funded account.\n   *\n   *      A non-zero `recipient` receives the funds directly and skips the interchain account router, so this path also\n   *      works on a lite deployment without one. It cannot fund a destination `EXECUTE_CROSS_CHAIN` plan, rejects a\n   *      custom ICA configuration, must be able to receive the asset on the destination chain, and must not be the\n   *      Metarouter, whose out-of-batch custody is publicly sweepable.\n   *\n   *      An ICA with balance sentinel support can forward its entire native balance with `type(uint256).max`. To spend\n   *      this bridge's output, reveal after the Warp transfer finalizes or begin the destination plan with an unflagged\n   *      `BALANCE_CHECK` on the execution address's native balance. Otherwise the call may forward only an older ICA\n   *      balance and consume the commitment before the bridged funds arrive.\n   * @param _input ABI-encoded `IMetarouter.BridgeTokenParams`.\n   * @param _icaRouter Interchain account router used to derive the destination account.\n   */\n  function bridgeToken(bytes calldata _input, IInterchainAccountRouter _icaRouter) external {\n    IMetarouter.BridgeTokenParams memory _params = abi.decode(_input, (IMetarouter.BridgeTokenParams));\n\n    bytes32 _recipient;\n    if (_params.recipient != address(0)) {\n      // Destination custody outside a batch is publicly sweepable, so the router itself is never a valid target.\n      if (_params.recipient == address(this)) revert IMetarouter.InvalidRecipient();\n      // A custom ICA configuration only exists to derive the account this path does not use.\n      if (_params.icaConfig.router != address(0) || _params.icaConfig.ism != address(0)) {\n        revert IMetarouter.InvalidInterchainAccountConfig();\n      }\n\n      _recipient = _addressToBytes32(_params.recipient);\n    } else {\n      // The derivation path needs the interchain account router; a lite deployment has none.\n      if (address(_icaRouter) == address(0)) revert IMetarouter.CommandDisabled(Commands.BRIDGE_TOKEN);\n\n      bool _usesCustomConfig = _usesCustomIcaConfig(_params.icaConfig);\n      if (!_usesCustomConfig && _icaRouter.routers(_params.domain) == bytes32(0)) {\n        revert IMetarouter.UnregisteredDomain();\n      }\n      bytes32 _userSalt = _addressToBytes32(MetarouterState.msgSender());\n      address _recipientAccount = _usesCustomConfig\n        ? _icaRouter.getRemoteInterchainAccount(\n          address(this), _params.icaConfig.router, _params.icaConfig.ism, _userSalt\n        )\n        : _icaRouter.getRemoteInterchainAccount(_params.domain, address(this), _userSalt);\n      _recipient = _addressToBytes32(_recipientAccount);\n    }\n\n    TokenRouterLib.Route memory _route = TokenRouterLib.Route({\n      sourceToken: _params.token,\n      sourceRouter: _params.bridge,\n      destination: _params.domain,\n      recipient: _recipient,\n      targetRouter: _params.targetRouter\n    });\n    TokenRouterLib.validateTargetRouter(_route);\n\n    // A native bridge funds the fee from the resolved spend, which is already bounded; an ERC20 bridge pays it on top.\n    if (_params.token != address(0)) {\n      if (_params.messageFee > MetarouterState.availableNativeBalance()) {\n        revert IMetarouter.InsufficientBalance(address(0));\n      }\n    }\n\n    TokenRouterLib.validateInputTokenMatches(_route);\n\n    bool _isNative = _params.token == address(0);\n    uint256 _amount;\n    if (_isNative) {\n      _amount = FundsLib.resolveBalance(address(0), MetarouterState.availableNativeBalance(), _params.spend);\n    } else if (_params.token == MetarouterState.nativeErc20()) {\n      // A native ERC20 pull and the message fee draw from the same batch native, so the fee is reserved from that\n      // native before the spend resolves against its native ERC20 decimals conversion.\n      _amount = FundsLib.resolveBalance(\n        _params.token, MetarouterState.availableErc20BalanceAfterMessageFee(_params.messageFee), _params.spend\n      );\n    } else {\n      _amount = FundsLib.resolveSpend(_params.token, _params.spend);\n    }\n    if (_amount == 0) revert IMetarouter.ZeroAmount();\n    uint256 _maxFee;\n    if (_params.maxFee.mode == IMetarouter.SpendMode.Pips) {\n      if (_params.maxFee.value > MAX_PIPS) revert IMetarouter.InvalidPips(_params.maxFee.value);\n      // Rounded up so truncation loosens the bound the caller accepted rather than tightening it.\n      _maxFee = Math.mulDiv(_amount, _params.maxFee.value, MAX_PIPS, Math.Rounding.Ceil);\n    } else {\n      _maxFee = _params.maxFee.value;\n    }\n\n    uint256 _total = TokenRouterLib.quote(_route, _amount);\n    uint256 _fee = _total - _amount;\n    if (_fee > _maxFee) revert IMetarouter.TokenFeeExceedsMax();\n    // Checked before subtracting: an absolute bound does not cap the fee at the amount the way a pip bound does.\n    if (_fee >= _amount) revert IMetarouter.TokenFeeExceedsAmount();\n    uint256 _bridgeAmount = _amount - _fee;\n\n    uint256 _nativeValue;\n    if (_isNative) {\n      // Forward only what the route charges for the reduced amount, so no excess reaches its hook.\n      // Revert if that exceeds the budget, since an underpaid hook may still dispatch an undeliverable message.\n      _nativeValue = TokenRouterLib.quote(_route, _bridgeAmount);\n      if (_nativeValue > _amount) revert IMetarouter.BridgeQuoteExceedsBudget(_nativeValue, _amount);\n    } else {\n      MetarouterState.trackERC20(_params.token);\n      _nativeValue = _params.messageFee;\n    }\n    // This command does not use the bridge message ID.\n    // slither-disable-next-line unused-return\n    TokenRouterLib.transferRemote(_route, _bridgeAmount, _fee, _nativeValue);\n  }\n\n  /**\n   * @notice Dispatches a destination-plan commitment through the logical sender's interchain account.\n   * @dev The reveal service builds the opaque commitment off-chain from the destination plan and a secret.\n   *      `BRIDGE_TOKEN` and this command reach the same ICA only when the destination domain, logical sender, router,\n   *      and ISM match. An empty ICA configuration uses the enrolled router and ISM, while a custom configuration uses\n   *      the supplied values. A zero custom ISM remains part of account derivation and selects Hyperlane's default\n   *      verifier during processing.\n   *\n   *      Hook metadata must include at least the 86-byte standard prefix and refund address field. A nonzero token at\n   *      bytes `[86:106]` selects ERC20 fees; an absent or zero field selects native fees. `tokenFee` caps how much the\n   *      ICA router can pull. Any amount it does not pull remains in the Metarouter and is returned with the batch's\n   *      other unused funds. For the chain's native ERC20 the cap must also fit the batch's native remaining\n   *      after `messageFee` commits, since a native ERC20 pull spends that same native; a larger cap reverts with\n   *      `InsufficientBalance` so a fee pull can never reach the pre-batch balance.\n   *\n   *      ERC20 fees require a deployed ICA router implementing Hyperlane v11.3.1's commit-reveal fee token flow and a\n   *      compatible hook chain. When paying fees in ERC20, `messageFee` must be zero and every fee-charging hook must\n   *      use the metadata token. This library does not validate those conditions, so incompatible combinations revert\n   *      downstream. `messageFee` is bounded by the batch's own native so a dispatch cannot transiently spend what\n   *      the router held before it.\n   * @param _input ABI-encoded `IMetarouter.ExecuteCrosschainParams`.\n   * @param _icaRouter Interchain account router that dispatches the commitment.\n   */\n  function executeCrosschain(bytes calldata _input, IInterchainAccountRouter _icaRouter) external {\n    IMetarouter.ExecuteCrosschainParams memory _params = abi.decode(_input, (IMetarouter.ExecuteCrosschainParams));\n\n    if (_params.messageFee > MetarouterState.availableNativeBalance()) {\n      revert IMetarouter.InsufficientBalance(address(0));\n    }\n\n    bool _usesCustomConfig = _usesCustomIcaConfig(_params.icaConfig);\n    bytes32 _router;\n    if (_usesCustomConfig) {\n      _router = _addressToBytes32(_params.icaConfig.router);\n    } else {\n      _router = _icaRouter.routers(_params.domain);\n      if (_router == bytes32(0)) revert IMetarouter.UnregisteredDomain();\n    }\n    if (_params.hookMetadata.length < _HOOK_METADATA_PREFIX_LENGTH) revert IMetarouter.InvalidHookMetadata();\n    bytes32 _ism = _usesCustomConfig ? _addressToBytes32(_params.icaConfig.ism) : _icaRouter.isms(_params.domain);\n\n    address _token;\n    bytes memory _hookMetadata = _params.hookMetadata;\n    if (_hookMetadata.length >= _HOOK_METADATA_PREFIX_LENGTH + 20) {\n      assembly ('memory-safe') {\n        // Skip the length word, seek the field, then drop the 12 trailing bytes the word overshoots into.\n        _token := shr(96, mload(add(add(_hookMetadata, 0x20), _HOOK_METADATA_PREFIX_LENGTH)))\n      }\n    }\n    if (_token != address(0)) {\n      // A native ERC20 fee pull spends the same native the message fee commits below, so the grant must fit the\n      // batch native remaining after that fee, converted to the native ERC20's decimals. Other tokens need no check: a\n      // pull beyond the balance reverts inside the token.\n      if (\n        _token == MetarouterState.nativeErc20()\n          && _params.tokenFee > MetarouterState.availableErc20BalanceAfterMessageFee(_params.messageFee)\n      ) {\n        revert IMetarouter.InsufficientBalance(_token);\n      }\n      MetarouterState.trackERC20(_token);\n      IERC20(_token).forceApprove(address(_icaRouter), _params.tokenFee);\n    }\n\n    // slither-disable-next-line arbitrary-send-eth,unused-return\n    _icaRouter.callRemoteCommitReveal{value: _params.messageFee}(\n      _params.domain,\n      _router,\n      _ism,\n      _params.hookMetadata,\n      _params.hook,\n      _addressToBytes32(MetarouterState.msgSender()),\n      _params.commitment\n    );\n\n    if (_token != address(0)) IERC20(_token).forceApprove(address(_icaRouter), 0);\n  }\n\n  /**\n   * @notice Burns held `ReceiptToken` through the leaf Voter, dispatching the message that mints `TOKEN` to the\n   *         recipient on root.\n   * @dev The voter burns the receipt from this router, so no approval is needed. `messageFee` is bounded by the\n   *      batch's own native so a redeem cannot transiently spend what the router held before it. Nothing on the leaf\n   *      quotes or checks the fee beyond that bound, so an underfunded `messageFee` reverts inside the transport. A\n   *      zero `refundRecipient` resolves to this router here, since the transport rejects a zero refund address once\n   *      it has an overpayment to return.\n   * @param _input ABI-encoded `IMetarouter.RedeemParams`.\n   * @param _leafVoter Leaf Voter that burns the receipt and dispatches the message.\n   * @param _receiptToken `ReceiptToken` the leaf Voter burns, this deployment's emission token.\n   */\n  function redeem(bytes calldata _input, ILeafVoter _leafVoter, IERC20 _receiptToken) external {\n    IMetarouter.RedeemParams memory _params = abi.decode(_input, (IMetarouter.RedeemParams));\n\n    if (_params.recipient == address(this)) revert IMetarouter.InvalidRecipient();\n    if (_params.messageFee > MetarouterState.availableNativeBalance()) {\n      revert IMetarouter.InsufficientBalance(address(0));\n    }\n\n    uint256 _amount = FundsLib.fund(address(_receiptToken), _params.spend, _params.payerIsUser);\n\n    address _refundRecipient = _params.refundRecipient == address(0) ? address(this) : _params.refundRecipient;\n\n    // The voter rejects a zero recipient and an amount below `MIN_REDEEM_AMOUNT`, which covers a zero amount too.\n    // slither-disable-next-line arbitrary-send-eth\n    _leafVoter.redeem{value: _params.messageFee}(_amount, _params.recipient, _params.gasLimit, _refundRecipient);\n  }\n\n  /**\n   * @notice Returns whether a command supplies a custom destination ICA configuration.\n   * @dev The all-zero configuration is the default sentinel. Once a custom router is supplied, the ISM may remain\n   *      zero intentionally; an ISM without a router is rejected so zero-router inputs cannot be interpreted two ways.\n   * @param _icaConfig Optional custom destination ICA router and ISM.\n   * @return _usesCustom Whether the command supplied a custom destination router.\n   */\n  function _usesCustomIcaConfig(IMetarouter.IcaConfig memory _icaConfig) private pure returns (bool _usesCustom) {\n    if (_icaConfig.router != address(0)) return true;\n    if (_icaConfig.ism != address(0)) revert IMetarouter.InvalidInterchainAccountConfig();\n    return false;\n  }\n\n  /**\n   * @notice Left-pads an address into a bytes32 word.\n   * @param _account Address to convert.\n   * @return _word The address in the low 20 bytes of a bytes32.\n   */\n  function _addressToBytes32(address _account) private pure returns (bytes32 _word) {\n    return bytes32(uint256(uint160(_account)));\n  }\n}\n"},"V3/src/metarouter/libraries/FundsLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {Math} from '@openzeppelin/contracts/utils/math/Math.sol';\n\nimport {MAX_PIPS} from 'V3/libraries/ProtocolConstants.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title FundsLib\n * @notice Shared token funding and balance-resolution helpers for the Metarouter command libraries.\n * @dev All functions are internal, so they inline into the command library (or the router) that uses them and\n *      operate on the router's own storage/transient context. Logical-sender resolution and custody tracking are\n *      delegated to `MetarouterState`.\n */\nlibrary FundsLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Pushes tokens the execution address holds to a recipient.\n   * @dev Moves the router's own balance out, so custody never grows and nothing is tracked. For the native ERC20\n   *      token, the amount is bounded by the balance available to the batch so pre-batch native cannot be spent\n   *      through its ERC20 entry point.\n   * @param _token ERC20 to transfer.\n   * @param _recipient Address receiving the tokens.\n   * @param _amount Token amount to transfer.\n   */\n  function push(address _token, address _recipient, uint256 _amount) internal {\n    if (_token == MetarouterState.nativeErc20() && _amount > MetarouterState.availableErc20Balance(_token)) {\n      revert IMetarouter.InsufficientBalance(_token);\n    }\n    IERC20(_token).safeTransfer(_recipient, _amount);\n  }\n\n  /**\n   * @notice Pulls tokens from the logical sender into the execution address.\n   * @dev The source is always `msgSender()` and the destination is always the execution address, so no addresses are\n   *      passed and no authorization check is needed. The token lands in custody, so it is tracked for the closure\n   *      sweep.\n   * @param _token ERC20 to transfer.\n   * @param _amount Token amount to transfer.\n   */\n  function pull(address _token, uint256 _amount) internal {\n    MetarouterState.trackERC20(_token);\n    // slither-disable-next-line arbitrary-send-erc20\n    IERC20(_token).safeTransferFrom(MetarouterState.msgSender(), address(this), _amount);\n  }\n\n  /**\n   * @notice Pays a recipient from the execution address or the logical sender.\n   * @dev Execution-address payments use the custody-protected `push` boundary. Logical-sender payments transfer\n   *      directly from the authorized sender and do not spend router custody.\n   * @param _token ERC20 to transfer.\n   * @param _payer Authorized payer: the execution address or the logical sender.\n   * @param _recipient Address receiving the payment.\n   * @param _amount Token amount to transfer.\n   */\n  function pay(address _token, address _payer, address _recipient, uint256 _amount) internal {\n    if (_payer == address(this)) {\n      push(_token, _recipient, _amount);\n      return;\n    }\n    // The zero check keeps an unset logical sender from ever authorizing a pull.\n    if (_payer == address(0) || _payer != MetarouterState.msgSender()) revert IMetarouter.InvalidPayer();\n    // slither-disable-next-line arbitrary-send-erc20\n    IERC20(_token).safeTransferFrom(_payer, _recipient, _amount);\n  }\n\n  /**\n   * @notice Resolves held funds or pulls an exact amount from the logical sender.\n   * @dev External funding returns the received balance delta so fee-on-transfer inputs remain usable, and accepts\n   *      `Amount` only. An external pull is bounded by the caller's ERC20 approval, so an exact amount is the\n   *      meaningful unit; a percentage of a wallet has no clean meaning here. `Pips` applies only to the\n   *      execution-address balance (the internal path); wallet-percentage funding, if ever needed, is `FUND_ERC20`.\n   * @param _token ERC20 being funded.\n   * @param _spend Selection applied when spending the execution address's balance.\n   * @param _payerIsUser Whether to pull an exact amount from the logical sender instead of the execution balance.\n   * @return _amount Amount available to the command after funding.\n   */\n  function fund(\n    address _token,\n    IMetarouter.BalanceSpend memory _spend,\n    bool _payerIsUser\n  ) internal returns (uint256 _amount) {\n    if (_payerIsUser) {\n      if (_spend.mode != IMetarouter.SpendMode.Amount) revert IMetarouter.InvalidSpendMode();\n      uint256 _balanceBefore = IERC20(_token).balanceOf(address(this));\n      pull(_token, _spend.value);\n      _amount = IERC20(_token).balanceOf(address(this)) - _balanceBefore;\n    } else {\n      _amount = resolveSpend(_token, _spend);\n      MetarouterState.trackERC20(_token);\n    }\n  }\n\n  /**\n   * @notice Resolves a spend against the execution address's token balance available to the batch.\n   * @dev The available balance excludes the pre-batch native for the chain's native ERC20, whose `balanceOf`\n   *      is the execution address's native balance; every other token resolves against its full balance.\n   * @param _token ERC20 whose balance is being resolved.\n   * @param _spend Balance selection mode and value.\n   * @return _amount Token amount selected by the spend mode.\n   */\n  function resolveSpend(\n    address _token,\n    IMetarouter.BalanceSpend memory _spend\n  ) internal view returns (uint256 _amount) {\n    return resolveBalance(_token, MetarouterState.availableErc20Balance(_token), _spend);\n  }\n\n  /**\n   * @notice Resolves a spend against a supplied asset balance.\n   * @param _asset ERC20 address, or address(0) for native ETH.\n   * @param _balance Current balance available to spend.\n   * @param _spend Balance selection mode and value.\n   * @return _amount Asset amount selected by the spend mode.\n   */\n  function resolveBalance(\n    address _asset,\n    uint256 _balance,\n    IMetarouter.BalanceSpend memory _spend\n  ) internal pure returns (uint256 _amount) {\n    if (_spend.mode == IMetarouter.SpendMode.Amount) {\n      if (_spend.value > _balance) {\n        revert IMetarouter.InsufficientBalance(_asset);\n      }\n      return _spend.value;\n    }\n    // The only remaining variant is SpendMode.Pips; an out-of-range mode Panics when `_spend.mode` is read above.\n    if (_spend.value > MAX_PIPS) revert IMetarouter.InvalidPips(_spend.value);\n    return Math.mulDiv(_balance, _spend.value, MAX_PIPS);\n  }\n}\n"},"V3/src/metarouter/libraries/LiquidityLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {Math} from '@openzeppelin/contracts/utils/math/Math.sol';\n\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {V2PoolLib} from 'V3/metarouter/libraries/V2PoolLib.sol';\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IPoolFactory} from 'V3/interfaces/factories/IPoolFactory.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\n\n/**\n * @title LiquidityLib\n * @notice V2 liquidity command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode while executing in the router's storage context. Funding, tracking, and\n *      logical-sender resolution go through `FundsLib` / `MetarouterState`; the `FactoryRegistry` is passed in because\n *      a library cannot read the router's immutables.\n *\n *      `addLiquidity` takes a factory and the token pair, requiring current approval only when creating a pool;\n *      both liquidity commands authenticate existing pools through their permanent `FactoryRegistry` records,\n *      the single path shared by legacy and V3 V2 pools. Volatile and stable variants differ only by deploying\n *      factory, so no stability flag is read: the proportional reserve quote and the per-token minimums are\n *      variant-agnostic. The pools are push-first, so tokens are transferred in before `mint`/`burn` is called.\n */\nlibrary LiquidityLib {\n  /**\n   * @notice Adds liquidity to a validated V2 pool and mints LP tokens to the recipient.\n   * @dev Resolves the pool through the selected factory, creating it only when the factory is approved and the caller\n   *      opted in. Validates the pool's recorded factory, membership, family, and requested pair. Every `A`/`B` input\n   *      refers to the token the caller supplied under that letter, so a pair given in reverse order only realigns the\n   *      reserves. Amounts are adjusted to the pool's current reserve ratio; unused tokens are returned at the end of\n   *      the batch. An unseeded pool is skimmed before funding so a stray pre-funding cannot revert the bootstrap. The\n   *      pool's mint result must meet the caller's LP minimum. LP tokens minted to the Metarouter can be used by a\n   *      later command or returned at batch end.\n   * @param _input ABI-encoded `AddLiquidityParams`.\n   * @param _factoryRegistry Factory registry that validates the selected factory (the router's immutable).\n   */\n  function addLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.AddLiquidityParams memory _params = abi.decode(_input, (IMetarouter.AddLiquidityParams));\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    address _pool = IPoolFactory(_params.factory).getPool(_params.tokenA, _params.tokenB);\n    if (_pool == address(0)) {\n      // Revert unless the caller explicitly allows creating and seeding a new pool.\n      if (!_params.createPool) revert IMetarouter.PoolNotFound();\n      if (!_factoryRegistry.isTargetFactoryApproved(_params.factory)) {\n        revert IMetarouter.FactoryNotApproved();\n      }\n      _pool = IPoolFactory(_params.factory).createPool(_params.tokenA, _params.tokenB);\n    }\n\n    if (V2PoolLib.validatePool(_pool, _factoryRegistry) != _params.factory) {\n      revert IMetarouter.InvalidPool(_pool);\n    }\n\n    // slither-disable-next-line unused-return\n    (,, uint256 _reserveA, uint256 _reserveB, address _poolToken0, address _poolToken1) = IPool(_pool).metadata();\n    if (_params.tokenA != _poolToken0 || _params.tokenB != _poolToken1) {\n      if (_params.tokenA != _poolToken1 || _params.tokenB != _poolToken0) {\n        revert IMetarouter.PoolTokenMismatch(_pool);\n      }\n      // The pair arrived in reverse pool order; realign the reserves so the quotes follow the caller's order.\n      (_reserveA, _reserveB) = (_reserveB, _reserveA);\n    }\n\n    uint256 _amountA = FundsLib.fund(_params.tokenA, _params.spendA, _params.payerAIsUser);\n    uint256 _amountB = FundsLib.fund(_params.tokenB, _params.spendB, _params.payerBIsUser);\n\n    // A seeded pool trims one side to the live ratio; the smaller quote wins so neither side\n    // exceeds what was funded.\n    if (_reserveA != 0 && _reserveB != 0) {\n      // Preserve the established floored forward quote whenever its quotient fits uint256. `mulDiv` can represent\n      // that quotient iff the product's high word is below the denominator. Otherwise quoting first would revert even\n      // though the imbalanced pool can accept a valid tokenB-limited deposit, so calculate only the reverse quote.\n      // The low word is intentionally unused: the quotient's representability depends only on the high word.\n      // slither-disable-next-line unused-return\n      (uint256 _amountBQuoteHigh,) = Math.mul512(_amountA, _reserveB);\n      if (_amountBQuoteHigh < _reserveA) {\n        uint256 _amountBOptimal = Math.mulDiv(_amountA, _reserveB, _reserveA);\n        if (_amountBOptimal <= _amountB) _amountB = _amountBOptimal;\n        else _amountA = Math.mulDiv(_amountB, _reserveA, _reserveB);\n      } else {\n        _amountA = Math.mulDiv(_amountB, _reserveA, _reserveB);\n      }\n    }\n\n    // The minimums bound the amount the router commits to the pool.\n    if (_amountA < _params.amountAMin) revert IMetarouter.InsufficientAmountA();\n    if (_amountB < _params.amountBMin) revert IMetarouter.InsufficientAmountB();\n\n    // Before the first deposit, skim only if either token has a balance.\n    if (_reserveA == 0 && _reserveB == 0) {\n      if (IERC20(_poolToken0).balanceOf(_pool) != 0 || IERC20(_poolToken1).balanceOf(_pool) != 0) {\n        IPool(_pool).skim(MetarouterState.msgSender());\n      }\n    }\n\n    FundsLib.push(_params.tokenA, _pool, _amountA);\n    FundsLib.push(_params.tokenB, _pool, _amountB);\n\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_pool);\n    uint256 _liquidity = IPool(_pool).mint(_params.recipient);\n    if (_liquidity < _params.liquidityMin) {\n      revert IMetarouter.InsufficientLiquidityMinted(_params.liquidityMin, _liquidity);\n    }\n  }\n\n  /**\n   * @notice Burns LP tokens of a validated V2 pool and sends the underlying tokens to the recipient.\n   * @dev A router recipient tracks both pool tokens so a later command can consume them and closure sweeps leftovers.\n   * @param _input ABI-encoded `RemoveLiquidityParams`.\n   * @param _factoryRegistry Factory registry that validates the pool target (the router's immutable).\n   */\n  function removeLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.RemoveLiquidityParams memory _params = abi.decode(_input, (IMetarouter.RemoveLiquidityParams));\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // slither-disable-next-line unused-return\n    V2PoolLib.validatePool(_params.pool, _factoryRegistry);\n\n    uint256 _liquidity = FundsLib.fund(_params.pool, _params.lpSpend, _params.payerIsUser);\n\n    if (_params.recipient == address(this)) {\n      (address _token0, address _token1) = IPool(_params.pool).tokens();\n      MetarouterState.trackERC20(_token0);\n      MetarouterState.trackERC20(_token1);\n    }\n\n    FundsLib.push(_params.pool, _params.pool, _liquidity);\n    (uint256 _amount0, uint256 _amount1) = IPool(_params.pool).burn(_params.recipient);\n\n    if (_amount0 < _params.amount0Min) revert IMetarouter.InsufficientAmount0();\n    if (_amount1 < _params.amount1Min) revert IMetarouter.InsufficientAmount1();\n  }\n}\n"},"V3/src/metarouter/libraries/MetarouterState.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {TransientTracking} from 'V3/metarouter/TransientTracking.sol';\n\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title MetarouterState\n * @notice Namespaced transient-storage slots and the accessors over them, shared by the Metarouter and its\n *         command libraries.\n * @dev The command libraries run via `DELEGATECALL` in the router's storage context, so both the router and the\n *      libraries must reference the exact same slots. Keeping the constants and their accessors here is the single\n *      source of truth that prevents the two from drifting. The accessors re-express the router's former custody\n *      virtuals (`_track`/`_msgSender`/`_availableNativeBalance`) as slot reads through `TransientTracking`.\n */\nlibrary MetarouterState {\n  /**\n   * @notice Original caller of the active outer batch, which doubles as the batch-active flag.\n   * @dev Set to the outer caller when a batch opens and cleared on close. Because the opener's `msg.sender` can never\n   *      be `address(0)` on-chain, a non-zero locker is an exact proxy for \"a batch is active\", so no separate active\n   *      flag is stored.\n   * @return The locker slot.\n   */\n  bytes32 public constant LOCKER_SLOT = keccak256('dromos.metarouter.execution.locker');\n\n  /**\n   * @notice Native balance held before the outer batch, excluding its `msg.value`.\n   * @return The pre-batch native-balance slot.\n   */\n  bytes32 public constant NATIVE_BALANCE_BEFORE_SLOT = keccak256('dromos.metarouter.execution.native.before');\n\n  /**\n   * @notice ERC20 entry point of the chain's native asset, published by the router when a batch opens.\n   * @dev The command libraries run via `DELEGATECALL` and cannot read the router's `NATIVE_ERC20` immutable, so the\n   *      batch opening copies it here for `availableErc20Balance`. Zero on a chain whose native asset has no ERC20\n   *      entry point, where no token ever matches it.\n   * @return The native ERC20 slot.\n   */\n  bytes32 public constant NATIVE_ERC20_SLOT = keccak256('dromos.metarouter.execution.nativeErc20');\n\n  /**\n   * @notice Native value in wei represented by one raw unit of the native ERC20, published by the router when a batch opens.\n   * @dev Copied from the router's `NATIVE_ERC20_SCALE` immutable alongside the native ERC20 token, so the decimal conversions\n   *      in `availableErc20Balance` and `availableErc20BalanceAfterMessageFee` are reachable via `DELEGATECALL`. Written\n   *      only when a native ERC20 exists, so it is never read while zero.\n   * @return The native-native ERC20 scale slot.\n   */\n  bytes32 public constant NATIVE_ERC20_SCALE_SLOT = keccak256('dromos.metarouter.execution.nativeErc20Scale');\n\n  /**\n   * @notice CL pool currently authorized to invoke the swap callback.\n   * @return The expected-callback-caller slot.\n   */\n  bytes32 public constant EXPECTED_CALLBACK_CALLER_SLOT = keccak256('dromos.metarouter.callback.caller');\n\n  /**\n   * @notice Deduplication flags for ERC20s brought into custody during the active batch.\n   * @return The tracked-flag namespace slot.\n   */\n  bytes32 public constant TRACKED_SLOT = keccak256('dromos.metarouter.sweep.token.tracked');\n\n  /**\n   * @notice Length-prefixed array of ERC20s brought into custody during the active batch.\n   * @return The tracked-array slot.\n   */\n  bytes32 public constant ERC20_ARRAY_SLOT = keccak256('dromos.metarouter.sweep.token.array');\n\n  /**\n   * @notice Length-prefixed array of NFT collections brought into custody during the active batch, index-aligned\n   *         with `NFT_TOKEN_ID_ARRAY_SLOT`.\n   * @return The tracked NFT-collection array slot.\n   */\n  bytes32 public constant NFT_COLLECTION_ARRAY_SLOT = keccak256('dromos.metarouter.nft.collection.array');\n\n  /**\n   * @notice Length-prefixed array of NFT token IDs brought into custody during the active batch, index-aligned with\n   *         `NFT_COLLECTION_ARRAY_SLOT`.\n   * @return The tracked NFT-token-id array slot.\n   */\n  bytes32 public constant NFT_TOKEN_ID_ARRAY_SLOT = keccak256('dromos.metarouter.nft.tokenId.array');\n\n  /**\n   * @notice Namespace seed for an NFT's deduplication-flag slot,\n   *         `keccak256(abi.encode(collection, tokenId, NFT_TRACKED_SLOT))`.\n   * @return The tracked NFT-flag namespace seed.\n   */\n  bytes32 public constant NFT_TRACKED_SLOT = keccak256('dromos.metarouter.nft.tracked');\n\n  /**\n   * @notice Collection of the single NFT a producer command left for a later command to consume, or zero when none is\n   *         in flight; paired with `IN_FLIGHT_TOKEN_ID_SLOT`.\n   * @return The in-flight NFT-collection slot.\n   */\n  bytes32 public constant IN_FLIGHT_COLLECTION_SLOT = keccak256('dromos.metarouter.inflight.collection');\n\n  /**\n   * @notice Token id of the single in-flight NFT, paired with `IN_FLIGHT_COLLECTION_SLOT`.\n   * @return The in-flight NFT-token-id slot.\n   */\n  bytes32 public constant IN_FLIGHT_TOKEN_ID_SLOT = keccak256('dromos.metarouter.inflight.tokenId');\n\n  /**\n   * @notice Collection the router currently expects an inbound position from, published for `onERC721Received`, which\n   *         runs in its own call frame and so cannot read the resolving command's manager; paired with\n   *         `EXPECTED_NFT_SENDER_SLOT`.\n   * @return The expected-NFT-collection slot.\n   */\n  bytes32 public constant EXPECTED_NFT_COLLECTION_SLOT = keccak256('dromos.metarouter.nft.expectedCollection');\n\n  /**\n   * @notice Sender the router currently expects an inbound position from, set only around the external call that\n   *         returns one, or zero when the router solicited none; paired with `EXPECTED_NFT_TOKEN_ID_SLOT`.\n   * @return The expected-NFT-sender slot.\n   */\n  bytes32 public constant EXPECTED_NFT_SENDER_SLOT = keccak256('dromos.metarouter.nft.expectedSender');\n\n  /**\n   * @notice Position the router currently expects back, paired with `EXPECTED_NFT_SENDER_SLOT`.\n   * @return The expected-NFT-token-id slot.\n   */\n  bytes32 public constant EXPECTED_NFT_TOKEN_ID_SLOT = keccak256('dromos.metarouter.nft.expectedTokenId');\n\n  /**\n   * @notice Registers a token brought into custody so it is returned to the caller at batch closure.\n   * @param _token ERC20 touched during the active batch.\n   */\n  function trackERC20(address _token) internal {\n    TransientTracking.track(ERC20_ARRAY_SLOT, TRACKED_SLOT, _token);\n  }\n\n  /**\n   * @notice Registers an NFT brought into custody so batch closure can verify it left the execution address.\n   * @dev Deduplicated per `(collection, tokenId)`; both are appended to the index-aligned arrays only on the first\n   *      touch.\n   * @param _collection NFT collection touched during the active batch.\n   * @param _tokenId Token id within `_collection`.\n   */\n  function trackNft(address _collection, uint256 _tokenId) internal {\n    bytes32 _flagSlot = _nftFlagSlot(_collection, _tokenId);\n    if (TransientTracking.load(_flagSlot) != 0) return;\n    TransientTracking.store(_flagSlot, 1);\n    TransientTracking.push(NFT_COLLECTION_ARRAY_SLOT, _collection);\n    TransientTracking.pushUint(NFT_TOKEN_ID_ARRAY_SLOT, _tokenId);\n  }\n\n  /**\n   * @notice Clears an NFT's custody deduplication flag.\n   * @dev Transient storage is transaction-scoped, so flags must be cleared between batches in one transaction.\n   * @param _collection NFT collection whose flag is cleared.\n   * @param _tokenId Token id within `_collection`.\n   */\n  function untrackNft(address _collection, uint256 _tokenId) internal {\n    TransientTracking.store(_nftFlagSlot(_collection, _tokenId), 0);\n  }\n\n  /**\n   * @notice Resets the NFT custody arrays for reuse in the same transaction.\n   */\n  function clearNftArrays() internal {\n    TransientTracking.clear(NFT_COLLECTION_ARRAY_SLOT);\n    TransientTracking.clear(NFT_TOKEN_ID_ARRAY_SLOT);\n  }\n\n  /**\n   * @notice Records the collection and position an inbound transfer is expected to return, and the sender it must come\n   *         from, ahead of the external call that returns it.\n   * @dev Mirrors the expected-callback-caller handshake the CL swap path uses: the sender slot must be empty, so a\n   *      command cannot overwrite another command's pending authorization. `onERC721Received` accepts a position only\n   *      while this is set and the caller, the transfer's `from`, and its token id all match; the receiver consumes it\n   *      before returning and the setting command verifies that consumption. Left unset the router solicits nothing,\n   *      and an unsolicited transfer cannot mint a custody flag a later command could operate. The withdrawal command\n   *      names the exact position it asks back, so binding the id as well keeps a misbehaving source from substituting\n   *      another position it custodies.\n   *\n   *      The collection is part of the authorization because the hook's arguments are supplied by its caller: without\n   *      it, any contract could present the expected sender and token id and have itself recorded as a custodied\n   *      collection. Two managers can also issue the same token id, so the collection is what keeps a position from one\n   *      of them out of state armed for the other.\n   * @param _collection Collection the position is expected to arrive from.\n   * @param _sender Address the position is expected to arrive from.\n   * @param _tokenId Position the sender is expected to return.\n   */\n  function setExpectedNft(address _collection, address _sender, uint256 _tokenId) internal {\n    if (TransientTracking.load(EXPECTED_NFT_SENDER_SLOT) != 0) revert IMetarouter.NftSenderNotCleared();\n    TransientTracking.store(EXPECTED_NFT_COLLECTION_SLOT, uint256(uint160(_collection)));\n    TransientTracking.store(EXPECTED_NFT_SENDER_SLOT, uint256(uint160(_sender)));\n    TransientTracking.store(EXPECTED_NFT_TOKEN_ID_SLOT, _tokenId);\n  }\n\n  /**\n   * @notice Consumes the expected NFT authorization once the requested position reaches the receiver.\n   * @dev All three fields are cleared before the receiver returns. The setting command verifies this consumption after\n   *      its external call, so an operation that returned no position reverts rather than leaving authorization behind.\n   */\n  function clearExpectedNft() internal {\n    TransientTracking.store(EXPECTED_NFT_COLLECTION_SLOT, 0);\n    TransientTracking.store(EXPECTED_NFT_SENDER_SLOT, 0);\n    TransientTracking.store(EXPECTED_NFT_TOKEN_ID_SLOT, 0);\n  }\n\n  /**\n   * @notice Records the single NFT a producer command leaves for a later command to consume.\n   * @dev Only one NFT may be in flight at a time, so a second producer before the first is consumed reverts. The\n   *      producer also tracks the NFT for custody so closure verifies it left even if no later command consumes it.\n   * @param _collection Collection of the produced NFT.\n   * @param _tokenId Token id of the produced NFT.\n   */\n  function setInFlightNft(address _collection, uint256 _tokenId) internal {\n    if (TransientTracking.load(IN_FLIGHT_COLLECTION_SLOT) != 0) revert IMetarouter.InFlightNftPresent();\n    TransientTracking.store(IN_FLIGHT_COLLECTION_SLOT, uint256(uint160(_collection)));\n    TransientTracking.store(IN_FLIGHT_TOKEN_ID_SLOT, _tokenId);\n  }\n\n  /**\n   * @notice Clears the in-flight slots when they hold the given NFT.\n   * @dev Called by a command that finishes using the in-flight NFT (staking, transferring, or burning it).\n   *      Batch closure never clears these slots, so consuming here is the only thing keeping a stale pair from\n   *      surviving into a later batch of the same transaction, where the next producer command would revert with\n   *      `InFlightNftPresent`. A no-op when the NFT is not the in-flight one.\n   * @param _collection Collection of the consumed NFT.\n   * @param _tokenId Token id of the consumed NFT.\n   */\n  function consumeInFlightNft(address _collection, uint256 _tokenId) internal {\n    (address _inFlightCollection, uint256 _inFlightTokenId) = inFlightNft();\n    if (_inFlightCollection == _collection && _inFlightTokenId == _tokenId) {\n      TransientTracking.store(IN_FLIGHT_COLLECTION_SLOT, 0);\n      TransientTracking.store(IN_FLIGHT_TOKEN_ID_SLOT, 0);\n    }\n  }\n\n  /**\n   * @notice Returns the position the router currently expects back, its collection, and the sender it must come from.\n   * @return _collection Expected collection.\n   * @return _sender Expected sender, or zero when the router solicited no position.\n   * @return _tokenId Position the expected sender must return.\n   */\n  function expectedNft() internal view returns (address _collection, address _sender, uint256 _tokenId) {\n    _collection = address(uint160(TransientTracking.load(EXPECTED_NFT_COLLECTION_SLOT)));\n    _sender = address(uint160(TransientTracking.load(EXPECTED_NFT_SENDER_SLOT)));\n    _tokenId = TransientTracking.load(EXPECTED_NFT_TOKEN_ID_SLOT);\n  }\n\n  /**\n   * @notice Returns the in-flight NFT, or `(address(0), 0)` when none is in flight.\n   * @return _collection In-flight NFT collection.\n   * @return _tokenId In-flight NFT token id.\n   */\n  function inFlightNft() internal view returns (address _collection, uint256 _tokenId) {\n    _collection = address(uint160(TransientTracking.load(IN_FLIGHT_COLLECTION_SLOT)));\n    _tokenId = TransientTracking.load(IN_FLIGHT_TOKEN_ID_SLOT);\n  }\n\n  /**\n   * @notice Resolves a command's position input, substituting the in-flight token id for the zero sentinel.\n   * @dev The position manager never mints token id zero, so zero is a safe sentinel for \"operate the NFT the batch just\n   *      produced\" whose id the plan could not know in advance. The sentinel resolves only when an in-flight NFT of the\n   *      expected collection is present, which binds the reference to the producer's exact output.\n   * @param _collection Collection the command operates on, matched against the in-flight collection for the sentinel.\n   * @param _tokenId Token id from the command, or zero to use the in-flight NFT.\n   * @return _resolved Concrete token id the command acts on.\n   */\n  function resolvePositionId(address _collection, uint256 _tokenId) internal view returns (uint256 _resolved) {\n    if (_tokenId != 0) return _tokenId;\n    (address _inFlightCollection, uint256 _inFlightTokenId) = inFlightNft();\n    if (_inFlightCollection != _collection) revert IMetarouter.NoInFlightNft();\n    return _inFlightTokenId;\n  }\n\n  /**\n   * @notice Returns whether an NFT is in the router's custody for the active batch.\n   * @dev Reads the NFT's own flag slot, not membership of the custody arrays. The two diverge: a command that releases\n   *      a position clears the flag while its array entry stays behind until closure resets the array lengths.\n   * @param _collection NFT collection to query.\n   * @param _tokenId Token id within `_collection`.\n   * @return _inCustody Whether the NFT entered custody during the active batch and has not been released.\n   */\n  function isNftInCustody(address _collection, uint256 _tokenId) internal view returns (bool _inCustody) {\n    return TransientTracking.load(_nftFlagSlot(_collection, _tokenId)) != 0;\n  }\n\n  /**\n   * @notice Number of NFTs brought into custody during the active batch.\n   * @return _length Count of tracked NFTs.\n   */\n  function trackedNftLength() internal view returns (uint256 _length) {\n    return TransientTracking.length(NFT_COLLECTION_ARRAY_SLOT);\n  }\n\n  /**\n   * @notice Returns a tracked NFT by index.\n   * @param _index Element index to read.\n   * @return _collection NFT collection at the index.\n   * @return _tokenId Token id at the index.\n   */\n  function trackedNftAt(uint256 _index) internal view returns (address _collection, uint256 _tokenId) {\n    _collection = TransientTracking.at(NFT_COLLECTION_ARRAY_SLOT, _index);\n    _tokenId = TransientTracking.atUint(NFT_TOKEN_ID_ARRAY_SLOT, _index);\n  }\n\n  /**\n   * @notice Returns the logical sender (outer caller) for the current batch.\n   * @return _sender Account whose assets and approvals command modules may use.\n   */\n  function msgSender() internal view returns (address _sender) {\n    return address(uint160(TransientTracking.load(LOCKER_SLOT)));\n  }\n\n  /**\n   * @notice Returns native ETH introduced during the active batch, excluding the pre-batch balance.\n   * @return _balance Native ETH available to spend this batch.\n   */\n  function availableNativeBalance() internal view returns (uint256 _balance) {\n    uint256 _nativeBalance = address(this).balance;\n    uint256 _nativeBalanceBefore = TransientTracking.load(NATIVE_BALANCE_BEFORE_SLOT);\n    if (_nativeBalance < _nativeBalanceBefore) revert IMetarouter.PreBatchNativeBalanceSpent();\n    return _nativeBalance - _nativeBalanceBefore;\n  }\n\n  /**\n   * @notice Returns a token balance the active batch may spend, which for the chain's native ERC20 is the\n   *         batch's own native converted to the native ERC20 decimals.\n   * @dev The native ERC20's `balanceOf` is the native balance in token decimals, so it is not read: spending the returned\n   *      amount moves that many raw native ERC20 units, and flooring the batch native keeps the movement within what the\n   *      batch introduced. The floored remainder only returns through the native refund. Every other token spends its\n   *      full balance.\n   * @param _token ERC20 whose available balance is read.\n   * @return _balance Token balance available to spend this batch.\n   */\n  function availableErc20Balance(address _token) internal view returns (uint256 _balance) {\n    if (_token == nativeErc20()) return availableNativeBalance() / nativeErc20Scale();\n    _balance = IERC20(_token).balanceOf(address(this));\n  }\n\n  /**\n   * @notice Returns the native ERC20 balance the active batch may spend once a committed native message fee\n   *         is reserved.\n   * @dev A native ERC20 pull and the native message fee draw from the same batch native, so the fee is deducted from the\n   *      batch native before the conversion to the native ERC20 decimals floors it. Saturates to zero instead of\n   *      underflowing. Only meaningful for the native ERC20; callers match the token against `nativeErc20`\n   *      first.\n   * @param _messageFee Native message fee committed alongside the native ERC20 spend.\n   * @return _balance Token balance available to spend this batch after the fee reservation.\n   */\n  function availableErc20BalanceAfterMessageFee(uint256 _messageFee) internal view returns (uint256 _balance) {\n    uint256 _nativeBalance = availableNativeBalance();\n    if (_messageFee >= _nativeBalance) return 0;\n    return (_nativeBalance - _messageFee) / nativeErc20Scale();\n  }\n\n  /**\n   * @notice Returns the chain's native ERC20 published for the active batch.\n   * @return _token The native ERC20, or zero when the chain has none.\n   */\n  function nativeErc20() internal view returns (address _token) {\n    return address(uint160(TransientTracking.load(NATIVE_ERC20_SLOT)));\n  }\n\n  /**\n   * @notice Returns the native value per raw native ERC20 unit published for the active batch.\n   * @return _scale Native value per raw native ERC20 unit; meaningful only while a native ERC20 is published.\n   */\n  function nativeErc20Scale() internal view returns (uint256 _scale) {\n    return TransientTracking.load(NATIVE_ERC20_SCALE_SLOT);\n  }\n\n  /**\n   * @notice Derives the transient deduplication-flag slot for an NFT.\n   * @param _collection NFT collection.\n   * @param _tokenId Token id within `_collection`.\n   * @return _slot Transient slot holding the NFT's custody flag.\n   */\n  function _nftFlagSlot(address _collection, uint256 _tokenId) private pure returns (bytes32 _slot) {\n    return keccak256(abi.encode(_collection, _tokenId, NFT_TRACKED_SLOT));\n  }\n}\n"},"V3/src/metarouter/libraries/PaymentsLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\n\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {IWETH} from 'V3/interfaces/external/IWETH.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title PaymentsLib\n * @notice Payment command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode while executing in the router's storage context. Funding, tracking, and\n *      logical-sender resolution go through `FundsLib`; the wrapped native token is passed in because a library\n *      cannot read the router's immutables.\n */\nlibrary PaymentsLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Sends the execution address's full token balance available to the batch to a recipient.\n   * @dev The execution address is rejected as recipient: sweeping to self is a no-op, and unlike `transfer` this\n   *      command does not track the token, so the balance would linger untracked and never reach the caller at closure.\n   *      The available balance excludes the pre-batch native for the chain's native ERC20, whose `balanceOf`\n   *      is the execution address's native balance.\n   * @param _input ABI-encoded token, recipient, and minimum amount.\n   */\n  function sweep(bytes calldata _input) external {\n    (address _token, address _recipient, uint256 _minAmount) = abi.decode(_input, (address, address, uint256));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    if (_recipient == address(this)) revert IMetarouter.InvalidRecipient();\n    uint256 _balance = MetarouterState.availableErc20Balance(_token);\n    if (_balance < _minAmount) revert IMetarouter.InsufficientBalance(_token);\n    if (_balance > 0) IERC20(_token).safeTransfer(_recipient, _balance);\n  }\n\n  /**\n   * @notice Sends a selected portion of an execution-address token balance.\n   * @dev Resolves the portion against the router's own balance, then pushes it out via `FundsLib.push`. The token is\n   *      tracked so any residual left after a partial send is swept back to the sender at closure.\n   * @param _input ABI-encoded token, recipient, and balance spend mode.\n   */\n  function transfer(bytes calldata _input) external {\n    (address _token, address _recipient, IMetarouter.BalanceSpend memory _spend) =\n      abi.decode(_input, (address, address, IMetarouter.BalanceSpend));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    uint256 _amount = FundsLib.resolveSpend(_token, _spend);\n    MetarouterState.trackERC20(_token);\n    if (_amount > 0) FundsLib.push(_token, _recipient, _amount);\n  }\n\n  /**\n   * @notice Sends an NFT held in batch custody to a recipient.\n   * @dev Leaves the custody flag set so batch closure verifies the router no longer owns the NFT, and consumes any\n   *      matching in-flight reference.\n   * @param _input ABI-encoded `(address collection, uint256 tokenId, address recipient)`, where token id zero selects\n   *        the in-flight NFT of `collection`.\n   */\n  function transferNft(bytes calldata _input) external {\n    (address _collection, uint256 _tokenId, address _recipient) = abi.decode(_input, (address, uint256, address));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    // A self-transfer is a no-op.\n    if (_recipient == address(this)) revert IMetarouter.InvalidRecipient();\n\n    _tokenId = MetarouterState.resolvePositionId(_collection, _tokenId);\n    if (!MetarouterState.isNftInCustody(_collection, _tokenId)) revert IMetarouter.NftNotInCustody();\n\n    IERC721(_collection).safeTransferFrom(address(this), _recipient, _tokenId);\n    MetarouterState.consumeInFlightNft(_collection, _tokenId);\n  }\n\n  /**\n   * @notice Pulls a selected portion of the logical sender's token balance into the execution address's custody.\n   * @dev Resolves the portion against the sender's wallet balance (so `Pips` means a share of the wallet), then pulls\n   *      it in via `FundsLib.pull`. Unlike `FundsLib.fund`, which pulls an exact amount and returns the received delta\n   *      for a handler to consume, this command measures nothing: the amount surfaces through the closure sweep and\n   *      later live-balance reads.\n   * @param _input ABI-encoded token and balance spend mode.\n   */\n  function fundErc20(bytes calldata _input) external {\n    (address _token, IMetarouter.BalanceSpend memory _spend) = abi.decode(_input, (address, IMetarouter.BalanceSpend));\n    uint256 _amount = FundsLib.resolveBalance(_token, IERC20(_token).balanceOf(MetarouterState.msgSender()), _spend);\n    if (_amount > 0) FundsLib.pull(_token, _amount);\n  }\n\n  /**\n   * @notice Wraps native ETH available to the current batch.\n   * @param _input ABI-encoded balance spend mode.\n   * @param _weth Wrapped native token to deposit into.\n   */\n  function wrapEth(bytes calldata _input, IWETH _weth) external {\n    IMetarouter.BalanceSpend memory _spend = abi.decode(_input, (IMetarouter.BalanceSpend));\n    uint256 _amount = FundsLib.resolveBalance(address(0), MetarouterState.availableNativeBalance(), _spend);\n    if (_amount > 0) {\n      MetarouterState.trackERC20(address(_weth));\n      // Destination is the immutable WETH, not an arbitrary address; the deposit wraps the caller's own native.\n      // slither-disable-next-line arbitrary-send-eth\n      _weth.deposit{value: _amount}();\n    }\n  }\n\n  /**\n   * @notice Unwraps a selected portion of the WETH balance and sends native ETH to a recipient.\n   * @param _input ABI-encoded recipient and balance spend mode.\n   * @param _weth Wrapped native token to withdraw from.\n   */\n  function unwrapWeth(bytes calldata _input, IWETH _weth) external {\n    (address _recipient, IMetarouter.BalanceSpend memory _spend) =\n      abi.decode(_input, (address, IMetarouter.BalanceSpend));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    // No `trackERC20` here: WETH reaches custody only through producers that already track it, so a residual left\n    // by a partial unwrap is still swept at closure.\n    uint256 _amount = FundsLib.resolveSpend(address(_weth), _spend);\n    if (_amount > 0) {\n      _weth.withdraw(_amount);\n      if (_recipient != address(this)) {\n        // Sweeps the caller's own unwrapped balance to the caller-chosen recipient.\n        // slither-disable-next-line arbitrary-send-eth\n        (bool _success, bytes memory _data) = _recipient.call{value: _amount}('');\n        if (!_success) revert IMetarouter.NativeTransferFailed(_data);\n      }\n    }\n  }\n}\n"},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport {SafeCast} from '@openzeppelin/contracts/utils/math/SafeCast.sol';\n\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IRelay} from 'V3/interfaces/relay/IRelay.sol';\nimport {IRelayFactory} from 'V3/interfaces/relay/IRelayFactory.sol';\nimport {IRelayFactoryRegistry} from 'V3/interfaces/relay/IRelayFactoryRegistry.sol';\nimport {IRelayState} from 'V3/interfaces/relay/IRelayState.sol';\n\n/**\n * @title StakeRelayLib\n * @notice sAERO-creation and relay-deposit command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode but runs in its storage context. Custody tracking, sender resolution, and funding\n *      go through `MetarouterState` / `FundsLib`; the VotingEscrow and its staking token are passed in because a\n *      library cannot read the router's immutables.\n *\n *      `CREATE_STAKE` and `DEPOSIT_RELAY` are root-only: the VotingEscrow and the relays exist only on the root\n *      deployment, so the router gates both on `IS_ROOT` before dispatch and these handlers receive a non-zero escrow.\n */\nlibrary StakeRelayLib {\n  using SafeERC20 for IERC20;\n  using SafeCast for uint256;\n\n  /**\n   * @notice Stakes the staking token into a freshly minted sAERO, retaining it in flight or delivering it.\n   * @dev Funds the staking token through `FundsLib.fund` (from the batch balance or the logical sender), approves the\n   *      escrow for that amount, and calls `createStake`, which pulls the amount and mints the sAERO to the router.\n   *      A recipient equal to the router leaves the new sAERO in flight so a later command can consume its otherwise\n   *      unknowable token id; any other non-zero recipient receives it immediately.\n   * @param _input ABI-encoded `(BalanceSpend spend, bool payerIsUser, uint48 stakingWeeks, bool isPermanent, address\n   *        recipient)`, where the router address retains the new sAERO in flight.\n   * @param _escrow VotingEscrow the stake is created through; non-zero, the router gates the command on `IS_ROOT`.\n   * @param _stakingToken Token the escrow stakes, funded and approved before the stake.\n   */\n  function createStake(bytes calldata _input, IVotingEscrow _escrow, IERC20 _stakingToken) external {\n    (\n      IMetarouter.BalanceSpend memory _spend,\n      bool _payerIsUser,\n      uint48 _stakingWeeks,\n      bool _isPermanent,\n      address _recipient\n    ) = abi.decode(_input, (IMetarouter.BalanceSpend, bool, uint48, bool, address));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // The downcast runs before the approve so an over-width amount fails before any effect.\n    uint128 _amount = FundsLib.fund(address(_stakingToken), _spend, _payerIsUser).toUint128();\n    // `createStake` pulls exactly `_amount`, so success consumes the allowance in full and no reset is needed.\n    _stakingToken.forceApprove(address(_escrow), _amount);\n    uint256 _tokenId = _escrow.createStake(_amount, _stakingWeeks, _isPermanent);\n\n    if (_recipient == address(this)) {\n      // The escrow mints directly to the router without invoking its receiver hook. Track the new sAERO and publish\n      // its otherwise unknowable id so a later command in this batch can resolve the zero sentinel.\n      MetarouterState.trackNft(address(_escrow), _tokenId);\n      MetarouterState.setInFlightNft(address(_escrow), _tokenId);\n    } else {\n      IERC721(address(_escrow)).safeTransferFrom(address(this), _recipient, _tokenId);\n    }\n  }\n\n  /**\n   * @notice Deposits an existing or in-flight sAERO into a caller-selected relay for the selected share recipient.\n   * @dev Pass-through custody: a zero token id resolves the in-flight sAERO; otherwise the router uses an sAERO already\n   *      in this batch's custody or pulls the logical sender's token with `transferFrom` (its receiver hook accepts\n   *      only a delivery the active command solicited). It requests the deposit for the selected share recipient,\n   *      returns the source sAERO to the logical sender, and consumes the in-flight reference when that was the source.\n   *\n   *      The relay is caller-supplied, so it is authenticated before any approval is granted: a spoofed relay could\n   *      otherwise report an authorized VPM and route the caller's weight to an attacker-chosen destination. The relay\n   *      names its factory, the RelayFactoryRegistry must approve that factory, and the factory must have created the\n   *      relay. The registry check alone would not do, since a spoofed relay can name any approved factory. A relay\n   *      that cannot answer the factory read reverts on its own; the caller picked it and can pick another.\n   *      The deposit moves weight through the relay's VoterPaymentsModule, so the relay and that VPM must\n   *      both be ERC721-authorized on the token at once. The single token-scoped approval goes to the caller-selected\n   *      relay (cleared when the sAERO returns); the operator grant goes to the VPM, which the escrow vouches for\n   *      through `isAuthorizedVPM` and which is revoked after the deposit.\n   *\n   *      Transferring the sAERO to the router clears the user's approval for that token. To deposit from the same\n   *      sAERO more than once in a batch, approve the router with `setApprovalForAll`. Otherwise, approve the token\n   *      again before each separate deposit transaction.\n   *\n   *      Caller preconditions, surfaced as relay-side reverts: the sAERO needs at least `_amount` of idle chain0\n   *      weight (set by a prior vote outside the router), and a permissioned relay must have allow-listed the router\n   *      and selected recipient. The custody round-trip also clears the sAERO's delegation and blocks same-block\n   *      re-delegation (escrow transfers checkpoint the delegator), so delegators must re-delegate after.\n   * @param _input ABI-encoded `(uint256 tokenId, uint256 amount, address relay, address recipient)`, where token id zero\n   *        uses the in-flight sAERO.\n   * @param _escrow VotingEscrow the sAERO belongs to; non-zero, the router gates the command on `IS_ROOT`.\n   * @param _relayFactoryRegistry RelayFactoryRegistry the caller-selected relay's factory is authenticated against;\n   *        non-zero on root.\n   */\n  function depositRelay(\n    bytes calldata _input,\n    IVotingEscrow _escrow,\n    IRelayFactoryRegistry _relayFactoryRegistry\n  ) external {\n    (uint256 _tokenId, uint256 _amount, address _relay, address _recipient) =\n      abi.decode(_input, (uint256, uint256, address, address));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    // Shares mint at keeper settlement, outside any batch, so a router recipient would leave them untracked on the\n    // execution address where the permissionless `SWEEP` takes them.\n    if (_recipient == address(this)) revert IMetarouter.InvalidRecipient();\n\n    // Authenticate the caller-selected relay before trusting anything it reports: a spoofed relay could otherwise name\n    // an authorized VPM and route the caller's weight to an attacker-chosen destination. The reported factory must be\n    // approved and must itself vouch for the relay, since a spoofed relay can name any approved factory.\n    address _relayFactory = IRelayState(_relay).factory();\n    if (!_relayFactoryRegistry.isRelayFactoryApproved(_relayFactory) || !IRelayFactory(_relayFactory).isRelay(_relay)) {\n      revert IMetarouter.UnauthorizedRelay();\n    }\n\n    // Vet the relay's VoterPaymentsModule before taking custody: the operator grant below goes to this address.\n    address _vpm = address(IRelay(_relay).vpm());\n    if (!_escrow.isAuthorizedVPM(_vpm)) revert IMetarouter.UnauthorizedRelayVpm();\n\n    _tokenId = MetarouterState.resolvePositionId(address(_escrow), _tokenId);\n    address _owner = MetarouterState.msgSender();\n    // A position the router currently owns must have entered custody during this batch. A tracked position may have\n    // been returned by an earlier command, so reacquire it from the logical sender whenever ownership has moved out.\n    if (_escrow.ownerOf(_tokenId) == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_escrow), _tokenId)) revert IMetarouter.NftNotInCustody();\n    } else {\n      // slither-disable-next-line arbitrary-send-erc20\n      _escrow.transferFrom(_owner, address(this), _tokenId);\n    }\n\n    _escrow.setApprovalForAll(_vpm, true);\n    _escrow.approve(_relay, _tokenId);\n\n    // The selected recipient receives the shares at settlement regardless of who holds the source sAERO then.\n    IRelay(_relay).requestDeposit(_tokenId, _amount, _recipient);\n\n    // Revoke the operator grant, return the source sAERO to the logical sender, and consume an in-flight reference.\n    _escrow.setApprovalForAll(_vpm, false);\n    _escrow.transferFrom(address(this), _owner, _tokenId);\n    MetarouterState.consumeInFlightNft(address(_escrow), _tokenId);\n  }\n}\n"},"V3/src/metarouter/libraries/StakingLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nimport {ClResolverLib} from 'V3/metarouter/libraries/ClResolverLib.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {GaugeLib} from 'V3/metarouter/libraries/GaugeLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {INonfungiblePositionManager} from 'V3/interfaces/external/INonfungiblePositionManager.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IGaugeFactory} from 'V3/interfaces/factories/IGaugeFactory.sol';\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\nimport {IV2Gauge} from 'V3/interfaces/gauges/IV2Gauge.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title StakingLib\n * @notice Gauge staking command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode but runs in its storage context. Custody tracking, sender resolution, and funding\n *      go through `MetarouterState` / `FundsLib`; the Voter, emission token, and factory registry are passed in\n *      because a library cannot read the router's immutables.\n *\n *      A gauge is validated through the Voter (`gaugeStates.isRegistered`), then its venue (V2 LP vs CL position) is\n *      read from its own factory `GAUGE_TYPE()`. The CL branch resolves the position manager from the registry's own\n *      gauge, target, and factory records rather than from calldata or from the gauge itself, so a staking command\n *      cannot name a collection. The V2 branch resolves nothing, and so makes no CL factory or manager call.\n */\nlibrary StakingLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Stakes a V2 LP balance or a CL position into a validated gauge, crediting the logical sender.\n   * @dev V2: funds the LP token through `FundsLib.fund` (from the batch balance or the logical sender), approves the\n   *      gauge for that amount, then deposits, which pulls it all and leaves no allowance. CL: takes the position into\n   *      custody (already held, or pulled from the logical sender), approves the gauge for it, then deposits. Either\n   *      way the gauge credits `msgSender()` as the staker.\n   * @param _input For a V2 gauge, ABI-encoded `(gauge, abi.encode(BalanceSpend, payerIsUser))`; for a CL gauge,\n   *        ABI-encoded `(gauge, abi.encode(tokenId))`, where a zero `tokenId` stakes the in-flight position.\n   * @param _leafVoter Leaf Voter used to validate the gauge target.\n   * @param _factoryRegistry Registry the CL path resolves the gauge's position manager through.\n   */\n  function stakeGauge(bytes calldata _input, ILeafVoter _leafVoter, IFactoryRegistry _factoryRegistry) external {\n    (address _gauge, bytes memory _payload) = abi.decode(_input, (address, bytes));\n    GaugeLib.requireRegisteredGauge(_gauge, _leafVoter);\n    address _owner = MetarouterState.msgSender();\n\n    (bool _isCl, IGaugeFactory _gaugeFactory) = GaugeLib.isClGauge(_gauge, _factoryRegistry);\n    if (_isCl) {\n      INonfungiblePositionManager _positionManager =\n        ClResolverLib.resolveGaugePositionManager(address(_gaugeFactory), _factoryRegistry);\n      uint256 _tokenId = MetarouterState.resolvePositionId(address(_positionManager), abi.decode(_payload, (uint256)));\n      _ensureNftCustody(_positionManager, _tokenId, _owner);\n      _positionManager.approve(_gauge, _tokenId);\n      IGauge(_gauge).depositFor(_tokenId, _owner);\n      // The position left the router for the gauge; clear the in-flight slots when it held this position.\n      MetarouterState.consumeInFlightNft(address(_positionManager), _tokenId);\n    } else {\n      (IMetarouter.BalanceSpend memory _spend, bool _payerIsUser) =\n        abi.decode(_payload, (IMetarouter.BalanceSpend, bool));\n      address _lpToken = IV2Gauge(_gauge).stakingToken();\n      uint256 _amount = FundsLib.fund(_lpToken, _spend, _payerIsUser);\n      // `depositFor` pulls exactly `_amount`, so success consumes the allowance in full and no reset is needed.\n      IERC20(_lpToken).forceApprove(_gauge, _amount);\n      IGauge(_gauge).depositFor(_amount, _owner);\n    }\n  }\n\n  /**\n   * @notice Withdraws the logical sender's V2 LP or CL stake from a validated gauge.\n   * @dev The router withdraws as an operator, so it needs the gauge's withdrawal approval for `msgSender()`. The V2 LP\n   *      or CL position returns to the router, and `withdrawFrom` also claims accrued emissions. Those reach the router\n   *      only when it holds claim approval, so the emission token is tracked only then. CL trading fees accrue to the\n   *      gauge while staked and are not delivered by withdrawal. A CL position returns through `safeTransferFrom`, so\n   *      `onERC721Received` tracks it; closure sweeps leftover ERC20s and requires the position to have left.\n   *      A V2 gauge slashes the account's full accrual while the early-unstake penalty window is live, so the\n   *      withdrawal then requires the explicit `allowPenalty` consent; a CL gauge slashes only what the position\n   *      accrued since its own deposit, so the flag is ignored there.\n   * @param _input For a V2 gauge, ABI-encoded `(gauge, abi.encode(amount), allowPenalty)`; for a CL gauge, ABI-encoded\n   *        `(gauge, abi.encode(tokenId), allowPenalty)`. The flag is ignored for CL gauges.\n   * @param _leafVoter Leaf Voter used to validate the gauge target.\n   * @param _emissionToken Emission token a gauge claim delivers on this chain, tracked when routed to the router.\n   * @param _factoryRegistry Registry the CL path resolves the gauge's position manager through.\n   */\n  function unstakeGauge(\n    bytes calldata _input,\n    ILeafVoter _leafVoter,\n    IERC20 _emissionToken,\n    IFactoryRegistry _factoryRegistry\n  ) external {\n    (address _gauge, bytes memory _payload, bool _allowPenalty) = abi.decode(_input, (address, bytes, bool));\n    GaugeLib.requireRegisteredGauge(_gauge, _leafVoter);\n    address _owner = MetarouterState.msgSender();\n    (bool _isCl, IGaugeFactory _gaugeFactory) = GaugeLib.isClGauge(_gauge, _factoryRegistry);\n    if (!_isCl) GaugeLib.requirePenaltyAllowed(_gauge, _owner, _allowPenalty);\n    bool _claimApproved = IGauge(_gauge).approvedForClaim(_owner, address(this));\n\n    if (_isCl) {\n      uint256 _tokenId = abi.decode(_payload, (uint256));\n      INonfungiblePositionManager _positionManager =\n        ClResolverLib.resolveGaugePositionManager(address(_gaugeFactory), _factoryRegistry);\n      // With claim approval, accrued emissions are sent to the router.\n      if (_claimApproved) MetarouterState.trackERC20(address(_emissionToken));\n      // The gauge returns the position through `safeTransferFrom`; set the collection, the gauge, and the position as\n      // expected so `onERC721Received` accepts and tracks exactly that delivery and nothing else can hand one in.\n      MetarouterState.setExpectedNft(address(_positionManager), _gauge, _tokenId);\n      IGauge(_gauge).withdrawFrom(_tokenId, _owner);\n      // The receiver consumes this authorization. If it remains set, the gauge returned without delivering the NFT\n      // through the authenticated callback and the entire withdrawal must revert.\n      // slither-disable-next-line unused-return\n      (, address _expectedSender,) = MetarouterState.expectedNft();\n      if (_expectedSender != address(0)) revert IMetarouter.NftNotReceived();\n    } else {\n      uint256 _amount = abi.decode(_payload, (uint256));\n      // The withdrawn V2 staking token always returns to the router.\n      MetarouterState.trackERC20(IV2Gauge(_gauge).stakingToken());\n      // With claim approval, the accrued emissions come to the router too.\n      if (_claimApproved) MetarouterState.trackERC20(address(_emissionToken));\n      IGauge(_gauge).withdrawFrom(_amount, _owner);\n    }\n  }\n\n  /**\n   * @notice Ensures the router holds the position, pulling it from the logical sender when it does not.\n   * @dev A position the router already owns must have entered during this batch — its tracking proves it — so a command\n   *      cannot operate an NFT stranded before the batch. Otherwise it is pulled from the logical sender, which\n   *      requires the router to hold the ERC721 approval.\n   * @param _positionManager Position manager holding the NFT.\n   * @param _tokenId Position to acquire.\n   * @param _owner Logical sender the position is pulled from when the router does not hold it.\n   */\n  function _ensureNftCustody(INonfungiblePositionManager _positionManager, uint256 _tokenId, address _owner) private {\n    if (_positionManager.ownerOf(_tokenId) == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_positionManager), _tokenId)) revert IMetarouter.NftNotInCustody();\n    } else {\n      // `transferFrom` does not call the receiver hook, so custody is recorded here instead. A failed pull reverts the\n      // batch and the write with it.\n      MetarouterState.trackNft(address(_positionManager), _tokenId);\n      // `_owner` is the logical caller (`msgSender`); the router only ever pulls the caller's own position.\n      // slither-disable-next-line arbitrary-send-erc20\n      _positionManager.transferFrom(_owner, address(this), _tokenId);\n    }\n  }\n}\n"},"V3/src/interfaces/core/IVotingEscrow.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IERC165} from '@openzeppelin/contracts/interfaces/IERC165.sol';\nimport {IERC4906} from '@openzeppelin/contracts/interfaces/IERC4906.sol';\nimport {IERC6372} from '@openzeppelin/contracts/interfaces/IERC6372.sol';\nimport {IERC721Enumerable} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';\nimport {IERC721, IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';\n\nimport {IGuardedAccessControlEnumerable} from 'V3/interfaces/access/IGuardedAccessControlEnumerable.sol';\nimport {IVotes} from 'V3/interfaces/core/IVotes.sol';\nimport {IToken} from 'V3/interfaces/token/IToken.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\n\ninterface IVotingEscrow is\n  IVotes,\n  IERC4906,\n  IERC6372,\n  IERC721Metadata,\n  IERC721Enumerable,\n  IGuardedAccessControlEnumerable\n{\n  /// @notice Deposit operation kind, used in the Deposit event.\n  /// @param CREATE_STAKE_TYPE Initial deposit creating a new stake.\n  /// @param INCREASE_STAKE_AMOUNT Adding tokens to an existing stake.\n  /// @param INCREASE_STAKING_PERIOD Extending the staking period of an existing stake.\n  /// @param REVIVE_STAKE_TYPE Deposit rebuilding an empty shell's stake on an existing tokenId.\n  enum DepositType {\n    CREATE_STAKE_TYPE,\n    INCREASE_STAKE_AMOUNT,\n    INCREASE_STAKING_PERIOD,\n    REVIVE_STAKE_TYPE\n  }\n\n  /// @notice Staked balance held by a sAERO. Packed into a single storage slot.\n  /// @param amount Underlying token amount staked.\n  /// @param end Unstake timestamp. Zero when the stake is permanent.\n  /// @param isPermanent Whether the stake is in permanent mode (no decay).\n  struct StakedBalance {\n    uint128 amount;\n    uint48 end;\n    bool isPermanent;\n  }\n\n  /// @notice Per-tokenId checkpoint of the staking curve. Packs into two storage slots.\n  /// @param bias Voting power at `ts` for the decay curve.\n  /// @param slope Per-second decay (-dweight / dt).\n  /// @param ts Timestamp at which the checkpoint was recorded.\n  /// @param permanent Amount counted as permanent at this checkpoint.\n  struct UserPoint {\n    int128 bias;\n    int128 slope;\n    uint48 ts;\n    uint128 permanent;\n  }\n\n  /// @notice Global checkpoint of the staking curve. Packs into two storage slots.\n  /// @param bias Total voting power at `ts` for the decay curves.\n  /// @param slope Aggregate per-second decay (-dweight / dt).\n  /// @param ts Timestamp at which the checkpoint was recorded.\n  /// @param permanentStakeBalance Total amount counted as permanent at this checkpoint.\n  struct GlobalPoint {\n    int128 bias;\n    int128 slope;\n    uint48 ts;\n    uint128 permanentStakeBalance;\n  }\n\n  /// @notice A checkpoint for recorded delegated voting weights at a certain timestamp.\n  /// @param fromTimestamp Timestamp at which the checkpoint took effect.\n  /// @param owner Owner of the tokenId at the checkpoint timestamp.\n  /// @param delegatedBalance Balance delegated to the owner at the checkpoint timestamp.\n  /// @param delegatee tokenId the owner is delegating to.\n  struct Checkpoint {\n    uint256 fromTimestamp;\n    address owner;\n    uint256 delegatedBalance;\n    uint256 delegatee;\n  }\n\n  /// @notice Source movement of a VPM-initiated rebalance: staking weight drained from an existing tokenId.\n  /// @dev A source is always a real, existing tokenId. The accumulator (tokenId 0) is rejected as a source and the\n  ///      mint sentinel (type(uint256).max) is meaningless as one, so no sentinel handling applies. Carries no\n  ///      recipient: sources only drain, they never mint.\n  /// @param tokenId Existing tokenId the staking weight is drained from.\n  /// @param amount Underlying amount drained from tokenId.\n  struct SourceDelta {\n    uint256 tokenId;\n    uint128 amount;\n  }\n\n  /// @notice Destination movement of a VPM-initiated rebalance: staking weight routed to a tokenId, mint, or accumulator.\n  /// @dev tokenId zero is the protocol accumulator. tokenId equal to type(uint256).max requests a mint to recipient.\n  /// @param tokenId Target tokenId or sentinel (0 for accumulator, type(uint256).max for mint).\n  /// @param amount Underlying amount moved against tokenId.\n  /// @param recipient Owner assigned to a freshly minted sAERO when tokenId is the mint sentinel; ignored otherwise.\n  struct DestinationDelta {\n    uint256 tokenId;\n    uint128 amount;\n    address recipient;\n  }\n\n  /// @notice Contract dependencies wired at construction.\n  /// @param token ERC20 token escrowed by the contract.\n  /// @param voter Voter the escrow mirrors chain0 ledger moves onto.\n  /// @param artProxy Initial art proxy used by tokenURI.\n  /// @param voterPaymentsModule Initial module authorized to rebalance stake.\n  struct Contracts {\n    address token;\n    address voter;\n    address artProxy;\n    address voterPaymentsModule;\n  }\n\n  /// @notice Initial holders of the escrow administration and fee-burning roles.\n  /// @param vpmAdmin Address granted VPM_ADMIN_ROLE.\n  /// @param artProxyAdmin Address granted ART_PROXY_ADMIN_ROLE.\n  /// @param burnFeesAdmin Address granted BURN_FEES_ADMIN_ROLE.\n  /// @param feesBurner Address granted BURN_FEES_ROLE, or zero when unassigned.\n  struct Admins {\n    address vpmAdmin;\n    address artProxyAdmin;\n    address burnFeesAdmin;\n    address feesBurner;\n  }\n\n  /// @notice Emitted when a deposit is recorded against a tokenId.\n  /// @param provider Address that funded the deposit.\n  /// @param tokenId tokenId that received the deposit.\n  /// @param depositType Kind of deposit performed.\n  /// @param value Amount deposited.\n  /// @param unstakeTime Updated unstake timestamp.\n  /// @param ts Block timestamp at which the event was emitted.\n  event Deposit(\n    address indexed provider,\n    uint256 indexed tokenId,\n    DepositType indexed depositType,\n    uint128 value,\n    uint256 unstakeTime,\n    uint256 ts\n  );\n\n  /// @notice Emitted when the protocol burns amount of the underlying TOKEN held at the accumulator.\n  /// @param amount Amount of TOKEN destroyed.\n  event Burn(uint128 amount);\n\n  /// @notice Emitted when an expired stake is withdrawn.\n  /// @param provider Address that withdrew the underlying tokens.\n  /// @param tokenId tokenId whose staked balance was zeroed.\n  /// @param value Amount withdrawn.\n  /// @param ts Block timestamp at which the event was emitted.\n  event Withdraw(address indexed provider, uint256 indexed tokenId, uint128 value, uint256 ts);\n\n  /// @notice Emitted when a stake is converted to permanent mode.\n  /// @param owner Owner of the tokenId.\n  /// @param tokenId tokenId switched to permanent mode.\n  /// @param amount Amount counted as permanent.\n  /// @param ts Block timestamp at which the event was emitted.\n  event UpgradeToPermanentStake(address indexed owner, uint256 indexed tokenId, uint128 amount, uint256 ts);\n\n  /// @notice Emitted when a permanent stake is converted back to decay mode.\n  /// @param owner Owner of the tokenId.\n  /// @param tokenId tokenId switched out of permanent mode.\n  /// @param amount Amount removed from the permanent balance.\n  /// @param ts Block timestamp at which the event was emitted.\n  event DowngradeFromPermanentStake(address indexed owner, uint256 indexed tokenId, uint128 amount, uint256 ts);\n\n  /// @notice Emitted when the total supply tracked by the contract changes.\n  /// @param supply Total supply after the change.\n  event Supply(uint128 supply);\n\n  /// @notice Emitted when a VPM-initiated rebalance moves staking weight between sTokens.\n  /// @param sources Source deltas processed by the rebalance, in input order.\n  /// @param destinations Destination deltas processed by the rebalance, in input order.\n  event Rebalance(SourceDelta[] sources, DestinationDelta[] destinations);\n\n  /// @notice Emitted when the art proxy contract is updated.\n  /// @param newProxy New art proxy address.\n  event ArtProxyUpdated(address indexed newProxy);\n\n  /// @notice Thrown when a rebalance routes the protocol accumulator (tokenId 0) as a source.\n  ///         The accumulator is destroyed exclusively through `burn`.\n  error AccumulatorCannotBeSource();\n\n  /// @notice Thrown when burn is called with an amount exceeding the accumulator's staked balance.\n  error AmountExceedsAccumulator();\n\n  /// @notice Thrown when a stake amount credit would exceed `type(int128).max`, the implicit cap required\n  ///         for the value to round-trip through the signed slope/bias math during a future downgrade.\n  ///         Without this guard a deposit between `type(int128).max + 1` and `type(uint128).max` succeeds\n  ///         while permanent but cannot be downgraded to decay, leaving funds stuck.\n  error AmountExceedsCap();\n\n  /// @notice Thrown when a rebalance source delta exceeds the stake amount on its tokenId.\n  /// @param tokenId tokenId whose source delta exceeds the staked amount.\n  error AmountExceedsStake(uint256 tokenId);\n\n  /// @notice Thrown when the sum of source deltas does not equal the sum of destination deltas in a rebalance.\n  error BalanceMismatch();\n\n  /// @notice Thrown when a rebalance leg that is not a mint (tokenId != type(uint256).max) carries a nonzero recipient.\n  /// @param tokenId tokenId of the offending leg.\n  error NonMintRecipientNotAllowed(uint256 tokenId);\n\n  /// @notice Thrown when a historical query is given a timestamp after the current block.\n  /// @param timestamp The future timestamp that was queried.\n  /// @param clock The current clock value at query time.\n  error FutureLookup(uint256 timestamp, uint48 clock);\n\n  /// @notice Thrown when the provided signature nonce does not match the expected nonce.\n  error InvalidNonce();\n\n  /// @notice Thrown when an ECDSA signature recovery returns the zero address.\n  error InvalidSignature();\n\n  /// @notice Thrown when the s component of an ECDSA signature lies in the upper half order.\n  error InvalidSignatureS();\n\n  /// @notice Thrown when the requested staking period resolves to the current block or earlier.\n  error StakingPeriodNotInFuture();\n\n  /// @notice Thrown when the requested staking period exceeds MAXTIME.\n  error StakingPeriodTooLong();\n\n  /// @notice Thrown when a permanent stake is requested with a non-zero staking period.\n  error StakingPeriodNotAllowed();\n\n  /// @notice Thrown when the stake has already expired.\n  error StakeExpired();\n\n  /// @notice Thrown when reviving a token that still holds a funded stake.\n  error StakeAlreadyFunded();\n\n  /// @notice Thrown when extending a stake that holds no funds; `reviveStake` rebuilds it instead.\n  error StakeNotFunded();\n\n  /// @notice Thrown when the stake has not yet expired.\n  error StakeNotExpired();\n\n  /// @notice Thrown when the operation requires the stake to be permanent and it is not.\n  error NotPermanentStake();\n\n  /// @notice Thrown when `rebalanceUnderlying` is called by an address that does not hold VPM_ROLE.\n  error NotVoterPaymentsModule();\n\n  /// @notice Thrown when ownership changed in the current block, blocking the operation.\n  error OwnershipChange();\n\n  /// @notice Thrown when the operation cannot be performed on a permanent stake.\n  error PermanentStake();\n\n  /// @notice Thrown when the signature expiry has passed.\n  error SignatureExpired();\n\n  /// @notice Thrown when a rebalance destination has an earlier unlock than the latest source unlock.\n  error UnlockTimeReduction();\n\n  /// @notice Thrown when a required address argument is the zero address.\n  error ZeroAddress();\n\n  /// @notice Thrown when a required amount argument is zero.\n  error ZeroAmount();\n\n  /*//////////////////////////////////////////////////////////////\n                          STATE-CHANGING FUNCTIONS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Set a new art proxy contract.\n  /// @dev Callable only by holders of ART_PROXY_ADMIN_ROLE.\n  /// @param _proxy Address of the new art proxy contract.\n  function setArtProxy(address _proxy) external;\n\n  /// @notice Record global data to checkpoint.\n  function checkpoint() external;\n\n  /// @notice Deposit _value tokens for msg.sender and stake for _stakingWeeks weeks, or permanently if\n  ///         _isPermanent is true.\n  /// @dev Reverts with StakingPeriodNotAllowed when _isPermanent is true and _stakingWeeks is non-zero,\n  ///      so callers cannot silently provide an unused period on a permanent stake.\n  /// @param _value Amount to deposit.\n  /// @param _stakingWeeks Number of weeks to stake tokens for. Must be zero when _isPermanent is true.\n  /// @param _isPermanent If true, create the stake directly in permanent mode with no expiry.\n  /// @return _tokenId tokenId of the created sToken.\n  function createStake(uint128 _value, uint48 _stakingWeeks, bool _isPermanent) external returns (uint256 _tokenId);\n\n  /// @notice Rebuild an empty shell's stake from scratch, reusing its tokenId: deposit _value and stake for\n  ///         _stakingWeeks weeks, or permanently if _isPermanent is true.\n  /// @dev Only an empty shell whose stake is over qualifies — withdrawn, or fully drained past its end. Reverts\n  ///      `StakeAlreadyFunded` on a funded position (those move through the increase/upgrade paths, keeping their\n  ///      committed shape), `PermanentStake`/`StakeNotExpired` while the shell's stake is not over, and\n  ///      `StakingPeriodNotAllowed` when _isPermanent is true and _stakingWeeks is non-zero.\n  /// @param _tokenId sToken whose stake is being rebuilt.\n  /// @param _value Amount to deposit.\n  /// @param _stakingWeeks Number of weeks to stake tokens for. Must be zero when _isPermanent is true.\n  /// @param _isPermanent If true, rebuild the stake directly in permanent mode with no expiry.\n  function reviveStake(uint256 _tokenId, uint128 _value, uint48 _stakingWeeks, bool _isPermanent) external;\n\n  /// @notice Deposit _value additional tokens for _tokenId without modifying the staking period.\n  /// @dev Only the owner or an approved operator may call this.\n  /// @param _tokenId tokenId to deposit into.\n  /// @param _value Amount of tokens to deposit and add to the stake.\n  function increaseStakeAmount(uint256 _tokenId, uint128 _value) external;\n\n  /// @notice Extend the staking period for _tokenId. Cannot extend permanent stakes.\n  /// @dev Re-anchors the Voter's recorded stake shape to the new end through `IVoter.parkOnChain0`, so the Voter's\n  ///      ledger keeps mirroring the live stake with no re-vote.\n  /// @dev Reverts `StakeNotFunded` on an empty shell: there is no period to extend, `reviveStake` rebuilds it.\n  /// @param _tokenId tokenId to extend.\n  /// @param _stakingWeeks New number of weeks until the stake ends.\n  function increaseStakingPeriod(uint256 _tokenId, uint48 _stakingWeeks) external;\n\n  /// @notice Withdraw the underlying TOKEN for an expired decay sToken to `_recipient`.\n  /// @dev Callable by the tokenId's owner or an approved operator. The whole stake must already sit on the\n  ///      Voter's `CHAIN0`: voting power still booked on a remote chain must be returned first (a leaf-first\n  ///      `deallocate`, or `emergencyDeallocate` for a suspended chain), else this reverts\n  ///      `IVoter.InsufficientChain0Allocation`. This keeps root and every leaf agreeing the token holds nothing\n  ///      on their chain before the Voter ledger is cleared. Zeroes `_staked[_tokenId]` but does not destroy the\n  ///      NFT: the tokenId persists at zero balance with its owner intact, per the ownership-preserving-zeroing\n  ///      invariant.\n  /// @param _tokenId tokenId whose staked TOKEN is withdrawn.\n  /// @param _recipient Address that receives the released TOKEN.\n  function withdraw(uint256 _tokenId, address _recipient) external;\n\n  /// @notice Upgrade a decaying sToken to a permanent stake. Staking weight will be equal to `StakedBalance.amount`\n  ///         with no decay. Required to delegate.\n  /// @dev Only callable on decaying sTokens that have not yet expired.\n  /// @dev Re-anchors the Voter's recorded stake shape to the permanent one through `IVoter.parkOnChain0`, so the\n  ///      Voter's ledger keeps mirroring the live stake with no re-vote.\n  /// @param _tokenId tokenId to convert to permanent.\n  function upgradeToPermanentStake(uint256 _tokenId) external;\n\n  /// @notice Convert a permanent sToken back to decay mode with end = (now + MAXTIME) week-aligned.\n  /// @dev Callable by the tokenId's owner or an approved operator. Requires the token's full balance to sit idle\n  ///      on the Voter's chain0 (no cross-chain allocations), else reverts `IVoter.InsufficientChain0Allocation`;\n  ///      deallocate with an empty `Voter.vote` first and re-vote afterwards. Subtracts the stake amount from\n  ///      permanentStakeBalance, clears delegation, and schedules a new slope change.\n  /// @param _tokenId tokenId to downgrade from permanent.\n  function downgradeFromPermanentStake(uint256 _tokenId) external;\n\n  /// @notice Move staking weight between sTokens in a single atomic operation.\n  /// @dev Callable by any VPM_ROLE holder. The VPM must itself be authorized (operator or token approval) by each\n  ///      source's owner, else the call reverts with the ERC721 approval error.\n  ///      Sources reduce stake amounts and update the permanent pool\n  ///      when permanent. Destinations route the moved amount to the protocol accumulator (tokenId zero), a freshly\n  ///      minted sToken (tokenId equal to type(uint256).max), or an existing sToken. Enforces sum(sources) ==\n  ///      sum(destinations) and the monotonic unlock rule: a destination unlock must not fall earlier than the latest\n  ///      source unlock, with permanent sources forcing every non-sentinel destination to be permanent. Mints use\n  ///      ERC721 _mint without the safe-mint receiver hook so VPM can predict the assigned IDs. After committing the\n  ///      moves, mirrors them onto the Voter's chain0 ledger via `VOTER.rebalanceChain0`.\n  /// @param _sources Source deltas reducing stake balances.\n  /// @param _destinations Destination deltas applying the moved amount per destination mode.\n  /// @return _mintedIds tokenIds assigned to mint destinations, in input order.\n  function rebalanceUnderlying(\n    SourceDelta[] calldata _sources,\n    DestinationDelta[] calldata _destinations\n  ) external returns (uint256[] memory _mintedIds);\n\n  /// @notice Destroy _amount of the underlying TOKEN held at the protocol accumulator (tokenId 0).\n  /// @dev Callable only by a BURN_FEES_ROLE holder. Decrements the accumulator amount, supply,\n  ///      and permanentStakeBalance symmetrically, calls the TOKEN's burn, then burns the matching voting\n  ///      power on the Voter's chain0 (the accumulator's VP is always parked there) via `VOTER.burn`.\n  /// @param _amount Amount of TOKEN to destroy.\n  function burnFees(uint128 _amount) external;\n\n  /// @inheritdoc IVotes\n  function delegate(uint256 _delegator, uint256 _delegatee) external;\n\n  /// @inheritdoc IVotes\n  function delegateBySig(\n    uint256 _delegator,\n    uint256 _delegatee,\n    uint256 _nonce,\n    uint256 _expiry,\n    uint8 _v,\n    bytes32 _r,\n    bytes32 _s\n  ) external;\n\n  /*//////////////////////////////////////////////////////////////\n                             VIEW FUNCTIONS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Role marker held by every VoterPaymentsModule that VotingEscrow recognises.\n  /// @return _role Role identifier.\n  function VPM_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Admin role for VPM_ROLE. Holders can grant or revoke VPM_ROLE.\n  /// @return _role Role identifier.\n  function VPM_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Role required to call `burnFees`.\n  /// @return _role Role identifier.\n  function BURN_FEES_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Admin role for BURN_FEES_ROLE. Holders can grant or revoke BURN_FEES_ROLE.\n  /// @return _role Role identifier.\n  function BURN_FEES_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Role allowed to set the art proxy contract.\n  /// @return _role Role identifier.\n  function ART_PROXY_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice EIP-712 typehash for the delegation struct used in delegateBySig.\n  /// @return _typehash Delegation typehash.\n  function DELEGATION_TYPEHASH() external view returns (bytes32 _typehash);\n\n  /// @notice Underlying token escrowed to create sAEROs.\n  /// @return _token The escrowed token.\n  function TOKEN() external view returns (IToken _token);\n\n  /// @notice Immutable Voter that VotingEscrow mirrors rebalance moves onto via `rebalanceChain0`.\n  /// @return _voter The bound Voter.\n  function VOTER() external view returns (IVoter _voter);\n\n  /// @notice Address of the art proxy used for on-chain metadata.\n  /// @return _proxy Art proxy address.\n  function artProxy() external view returns (address _proxy);\n\n  /// @notice Latest tokenId minted; doubles as the monotonic ID counter.\n  /// @return _tokenId Latest tokenId.\n  function tokenId() external view returns (uint256 _tokenId);\n\n  /// @notice Version tag of the contract.\n  /// @return _version Version string.\n  function VERSION() external view returns (string memory _version);\n\n  /// @notice Whether the given address is authorized as a VoterPaymentsModule.\n  /// @param _account Candidate address to check.\n  /// @return _authorized True when _account holds VPM_ROLE.\n  function isAuthorizedVPM(address _account) external view returns (bool _authorized);\n\n  /// @notice Whether a VoterPaymentsModule may operate on a specific tokenId at the VotingEscrow layer.\n  /// @dev True when `_vpm` holds VPM_ROLE and is ERC-721 authorized for the token; nonexistent token returns false.\n  /// @param _vpm Candidate VoterPaymentsModule address.\n  /// @param _tokenId tokenId being targeted.\n  /// @return _authorized True when the VPM is authorized for this tokenId.\n  function isAuthorizedVPMForToken(address _vpm, uint256 _tokenId) external view returns (bool _authorized);\n\n  /// @notice Total count of global checkpoints recorded since contract creation.\n  /// @return _epoch Latest global epoch.\n  function epoch() external view returns (uint256 _epoch);\n\n  /// @notice Total amount of underlying token currently held in escrow.\n  /// @return _supply Total supply.\n  function supply() external view returns (uint128 _supply);\n\n  /// @notice Aggregate balance held in permanent stakes.\n  /// @return _permanent Aggregate permanent staked balance.\n  function permanentStakeBalance() external view returns (uint128 _permanent);\n\n  /// @notice Latest checkpoint epoch recorded for a given tokenId.\n  /// @param _tokenId tokenId to query.\n  /// @return _epoch Latest user checkpoint epoch.\n  function userPointEpoch(uint256 _tokenId) external view returns (uint256 _epoch);\n\n  /// @notice Scheduled signed slope change at a given timestamp.\n  /// @param _timestamp Timestamp to query.\n  /// @return _slopeChange Signed slope delta scheduled at the timestamp.\n  function slopeChanges(uint48 _timestamp) external view returns (int128 _slopeChange);\n\n  /// @notice Global checkpoint history at a given epoch index.\n  /// @param _loc Global epoch index.\n  /// @return _point Global checkpoint snapshot.\n  function pointHistory(uint256 _loc) external view returns (GlobalPoint memory _point);\n\n  /// @notice Get the StakedBalance (amount, end, isPermanent) for a tokenId.\n  /// @dev tokenId 0 is the protocol accumulator, a permanent position from deployment.\n  /// @param _tokenId tokenId to query.\n  /// @return _staked StakedBalance for the tokenId.\n  function staked(uint256 _tokenId) external view returns (StakedBalance memory _staked);\n\n  /// @notice User checkpoint history for a given tokenId and index.\n  /// @param _tokenId tokenId to query.\n  /// @param _loc User epoch index.\n  /// @return _point User checkpoint snapshot.\n  function userPointHistory(uint256 _tokenId, uint256 _loc) external view returns (UserPoint memory _point);\n\n  /// @notice Get the voting power for _tokenId at the current timestamp.\n  /// @param _tokenId tokenId to query.\n  /// @return _balance Voting power at the current timestamp.\n  function balanceOfNFT(uint256 _tokenId) external view returns (uint256 _balance);\n\n  /// @notice Get the voting power for _tokenId at a given timestamp.\n  /// @param _tokenId tokenId to query.\n  /// @param _t Timestamp to query voting power at.\n  /// @return _balance Voting power at the given timestamp.\n  function balanceOfNFTAt(uint256 _tokenId, uint256 _t) external view returns (uint256 _balance);\n\n  /// @notice Check whether spender is owner or an approved user for a given sAERO.\n  /// @param _spender Caller to check.\n  /// @param _tokenId tokenId to check authorization for.\n  /// @return _approved True if the spender is authorized.\n  function isAuthorized(address _spender, uint256 _tokenId) external view returns (bool _approved);\n\n  /// @notice Total number of sTOKENs in existence.\n  /// @return _supply Number of sTOKENs minted.\n  function totalSupply() external view override(IERC721Enumerable) returns (uint256 _supply);\n\n  /// @notice Calculate total voting power at current timestamp.\n  /// @return _votingPower Total voting power at the current timestamp.\n  function totalVotingPower() external view returns (uint256 _votingPower);\n\n  /// @notice Calculate total voting power at a given timestamp.\n  /// @param _t Timestamp to query total voting power at.\n  /// @return _votingPower Total voting power at the given timestamp.\n  function totalVotingPowerAt(uint256 _t) external view returns (uint256 _votingPower);\n\n  /// @notice Block in which a tokenId's ownership last changed; used for the same-block delegation guard.\n  /// @dev Returns 0 for tokens that have never been transferred or have not changed ownership.\n  /// @param _tokenId tokenId to query.\n  /// @return _block Block number of the last ownership change.\n  function ownershipChange(uint256 _tokenId) external view returns (uint256 _block);\n\n  /// @notice The number of delegation checkpoints recorded for each tokenId.\n  /// @param _tokenId tokenId to query.\n  /// @return _count Number of recorded checkpoints.\n  function numCheckpoints(uint256 _tokenId) external view returns (uint48 _count);\n\n  /// @notice Signature nonce for the given account.\n  /// @param _account Account to query.\n  /// @return _nonce Current nonce.\n  function nonces(address _account) external view returns (uint256 _nonce);\n\n  /// @inheritdoc IVotes\n  function delegates(uint256 _delegator) external view returns (uint256);\n\n  /// @notice A record of delegated token checkpoints for each account, by index.\n  /// @param _tokenId tokenId to query.\n  /// @param _index Checkpoint index to query.\n  /// @return _checkpoint Recorded checkpoint.\n  function checkpoints(uint256 _tokenId, uint48 _index) external view returns (Checkpoint memory _checkpoint);\n\n  /// @inheritdoc IVotes\n  function getPastVotes(address _account, uint256 _tokenId, uint256 _timestamp) external view returns (uint256);\n\n  /// @inheritdoc IVotes\n  function getPastTotalSupply(uint256 _timestamp) external view returns (uint256);\n\n  /// @inheritdoc IERC6372\n  function clock() external view returns (uint48);\n\n  /// @inheritdoc IERC6372\n  function CLOCK_MODE() external view returns (string memory);\n}\n"},"V3/src/interfaces/external/IInterchainAccountRouter.sol":{"content":"// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * @title IInterchainAccountRouter\n * @notice Minimal view of the Hyperlane Interchain Account Router (v3) used by the Metarouter's cross-chain commands.\n * @dev Hyperlane's `@hyperlane-xyz/core` ships no interface for its `InterchainAccountRouter`; the methods used here\n *      exist only on the concrete contract, which is an upgradeable `^0.8.13` implementation with a large dependency\n *      tree. This minimal interface mirrors that contract's selectors instead of importing it. The `_hook` argument\n *      is typed as `address` because interface types encode as `address` in the function selector, so it matches\n *      Hyperlane's `IPostDispatchHook` parameter without importing it.\n */\ninterface IInterchainAccountRouter {\n  /**\n   * @notice Dispatches a commitment and its reveal to a destination interchain account.\n   * @param _destination Destination Hyperlane domain.\n   * @param _router Destination router address, as bytes32.\n   * @param _ism Destination interchain security module, as bytes32.\n   * @param _hookMetadata Post-dispatch hook metadata for the reveal message.\n   * @param _hook Post-dispatch hook to run after dispatching to the mailbox.\n   * @param _salt User-provided salt controlling account derivation.\n   * @param _commitment Commitment to the destination calls.\n   * @return _commitmentMsgId Hyperlane message id of the commitment message.\n   * @return _revealMsgId Hyperlane message id of the reveal message.\n   */\n  function callRemoteCommitReveal(\n    uint32 _destination,\n    bytes32 _router,\n    bytes32 _ism,\n    bytes calldata _hookMetadata,\n    address _hook,\n    bytes32 _salt,\n    bytes32 _commitment\n  ) external payable returns (bytes32 _commitmentMsgId, bytes32 _revealMsgId);\n\n  /**\n   * @notice Derives the deterministic interchain account owned by `_owner` on `_destination`.\n   * @dev The account is not guaranteed to be deployed; the address depends on the destination router and ISM\n   *      configured for `_destination` and on the user salt.\n   * @param _destination Destination Hyperlane domain.\n   * @param _owner Local owner of the interchain account.\n   * @param _userSalt User-provided salt controlling account derivation.\n   * @return _account Remote address of the interchain account.\n   */\n  function getRemoteInterchainAccount(\n    uint32 _destination,\n    address _owner,\n    bytes32 _userSalt\n  ) external view returns (address _account);\n\n  /**\n   * @notice Derives a deterministic remote interchain account from a custom destination router and ISM.\n   * @dev The account is not guaranteed to be deployed. A zero `_ism` remains part of the account derivation and\n   *      delegates message verification to Hyperlane's default ISM.\n   * @param _owner Local owner of the interchain account.\n   * @param _router Custom destination interchain account router.\n   * @param _ism Custom destination interchain security module, or zero to use Hyperlane's default verifier.\n   * @param _userSalt User-provided salt controlling account derivation.\n   * @return _account Remote address of the interchain account.\n   */\n  function getRemoteInterchainAccount(\n    address _owner,\n    address _router,\n    address _ism,\n    bytes32 _userSalt\n  ) external view returns (address _account);\n\n  /**\n   * @notice Returns the destination router registered for a domain.\n   * @param _domain Destination Hyperlane domain.\n   * @return _router Destination router address, as bytes32.\n   */\n  function routers(uint32 _domain) external view returns (bytes32 _router);\n\n  /**\n   * @notice Returns the interchain security module registered for a domain.\n   * @param _domain Destination Hyperlane domain.\n   * @return _ism Destination interchain security module, as bytes32.\n   */\n  function isms(uint32 _domain) external view returns (bytes32 _ism);\n\n  /**\n   * @notice Returns the Hyperlane domain of the chain this router runs on.\n   * @return _domain The local domain.\n   */\n  function localDomain() external view returns (uint32 _domain);\n}\n"},"V3/src/interfaces/external/IWETH.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWETH is IERC20 {\n  /// @notice Deposits native tokens and mints wrapped native tokens to the caller\n  function deposit() external payable;\n\n  /// @notice Burns wrapped native tokens and returns native tokens to the caller\n  /// @param _wad The amount of wrapped native tokens to unwrap\n  function withdraw(uint256 _wad) external;\n}\n"},"V3/src/interfaces/factories/IFactoryRegistry.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IFactoryRegistry\n * @notice Per-chain approval gate for factories and relationship graph of the\n *         protocol. Tracks which gauge factories and target factories may\n *         participate on the chain, records how gauges, targets, factories\n *         and rewards contracts relate and holds the meta router allowlist.\n */\ninterface IFactoryRegistry {\n  /**\n   * @notice Emitted when a gauge factory is registered into the approval set.\n   * @param _gaugeFactory The registered gauge factory.\n   */\n  event GaugeFactoryRegistered(address indexed _gaugeFactory);\n\n  /**\n   * @notice Emitted when a gauge factory and a target factory are linked.\n   * @param _gaugeFactory The linked gauge factory.\n   * @param _targetFactory The target factory the gauge factory serves.\n   */\n  event FactoriesLinked(address indexed _gaugeFactory, address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when a gauge factory is removed from the approval set.\n   * @param _gaugeFactory The unregistered gauge factory.\n   */\n  event GaugeFactoryUnregistered(address indexed _gaugeFactory);\n\n  /**\n   * @notice Emitted when a target factory is registered into the approval set.\n   * @param _targetFactory The registered target factory.\n   */\n  event TargetFactoryRegistered(address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when a target factory is removed from the approval set.\n   * @param _targetFactory The unregistered target factory.\n   */\n  event TargetFactoryUnregistered(address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when a target factory records a freshly deployed target.\n   * @param _target The recorded target.\n   * @param _targetFactory The target factory that deployed the target.\n   */\n  event TargetCreated(address indexed _target, address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when the GaugeManager records a freshly created gauge.\n   * @param _gauge The recorded gauge.\n   * @param _gaugeFactory The gauge factory that deployed the gauge.\n   * @param _target The target the gauge points at.\n   * @param _rewards The gauge's rewards contract.\n   */\n  event GaugeRegistered(\n    address indexed _gauge, address indexed _gaugeFactory, address indexed _target, address _rewards\n  );\n\n  /**\n   * @notice Emitted when the TokenRegistry pointer is updated.\n   * @param _tokenRegistry The new TokenRegistry.\n   */\n  event TokenRegistrySet(address indexed _tokenRegistry);\n\n  /**\n   * @notice Emitted when the LeafVoter is wired in.\n   * @param _leafVoter The LeafVoter address.\n   */\n  event LeafVoterSet(address indexed _leafVoter);\n\n  /**\n   * @notice Emitted when the target factory admin is set.\n   * @param _targetFactoryAdmin The new target factory admin.\n   */\n  event TargetFactoryAdminSet(address indexed _targetFactoryAdmin);\n\n  /**\n   * @notice Emitted when a meta router is registered into the approval set.\n   * @param _metaRouter The registered meta router.\n   */\n  event MetaRouterRegistered(address indexed _metaRouter);\n\n  /**\n   * @notice Emitted when a meta router is removed from the approval set.\n   * @param _metaRouter The unregistered meta router.\n   */\n  event MetaRouterUnregistered(address indexed _metaRouter);\n\n  /**\n   * @notice Thrown when the caller lacks the required authorization.\n   */\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a zero address is invalid.\n   */\n  error ZeroAddress();\n\n  /**\n   * @notice Thrown when registering an entry already in its approval set.\n   */\n  error AlreadyRegistered();\n\n  /**\n   * @notice Thrown when unregistering an entry not in its approval set.\n   */\n  error NotRegistered();\n\n  /**\n   * @notice Thrown when a target factory required by the operation is not in the approval set.\n   */\n  error TargetFactoryNotRegistered();\n\n  /**\n   * @notice Thrown when a gauge factory required by the operation is not in the approval set.\n   */\n  error GaugeFactoryNotRegistered();\n\n  /**\n   * @notice Thrown when registering a target already recorded in the registry.\n   */\n  error TargetAlreadyRecorded();\n\n  /**\n   * @notice Thrown when registering a gauge already recorded in the registry.\n   */\n  error GaugeAlreadyRecorded();\n\n  /**\n   * @notice Thrown when registering a gauge with a rewards contract already recorded for another gauge.\n   */\n  error RewardsAlreadyRecorded();\n\n  /**\n   * @notice Thrown when adding an entry already present in a factory enumeration.\n   */\n  error AlreadyEnumerated();\n\n  /**\n   * @notice Thrown when linking a gauge to a target not recorded in the registry.\n   */\n  error TargetNotRecorded();\n\n  /**\n   * @notice Thrown when linking a gauge to a target already linked to a gauge.\n   */\n  error TargetAlreadyLinked();\n\n  /**\n   * @notice Thrown when linking a gauge to a target not deployed by its factory's linked target factory.\n   */\n  error TargetFactoryMismatch();\n\n  /**\n   * @notice Thrown when registering a gauge factory against a target factory other than its linked one.\n   */\n  error GaugeFactoryAlreadyLinked();\n\n  /**\n   * @notice Thrown when registering a gauge factory against a target factory already linked to another gauge factory.\n   */\n  error TargetFactoryAlreadyLinked();\n\n  /**\n   * @notice Thrown when the operation requires a gauge factory with a linked target factory and none is recorded.\n   */\n  error NotLinked();\n\n  /**\n   * @notice Thrown when setting the LeafVoter after it has already been set.\n   */\n  error LeafVoterAlreadySet();\n\n  /**\n   * @notice Thrown when deploying with a target factory admin while the LeafVoter is provided.\n   */\n  error TargetFactoryAdminNotAllowed();\n\n  /**\n   * @notice Register a gauge factory and the target factory it serves as a\n   *         pair, writing their permanent one to one link on first\n   *         registration. The only writer of the link. Registering a\n   *         previously unregistered pair reapproves it against the recorded\n   *         link. The target factory may already be approved through the\n   *         target factory admin, in which case this call links it to its\n   *         gauge factory.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts on zero addresses, when either factory is linked to a\n   *      different counterpart and when the gauge factory is already in its\n   *      approval set.\n   * @param _gaugeFactory The gauge factory to register.\n   * @param _targetFactory The target factory the gauge factory serves.\n   */\n  function registerFactories(address _gaugeFactory, address _targetFactory) external;\n\n  /**\n   * @notice Register a target factory into the approval set without a gauge\n   *         factory pair. Lets the lite launch approve pool factories before\n   *         the LeafVoter and the gauge stack exist, with the gauge factory\n   *         linked later through registerFactories.\n   * @dev Caller must be the target factory admin. Reverts on the zero address\n   *      and a target factory already in the set.\n   * @param _targetFactory The target factory to register.\n   */\n  function registerTargetFactory(address _targetFactory) external;\n\n  /**\n   * @notice Wire the LeafVoter the registry resolves roles and the\n   *         GaugeManager through. The lite launch deploys the registry before\n   *         the LeafVoter, so the voter is set once by the target factory\n   *         admin here instead of at construction. Wiring the voter clears\n   *         the target factory admin, disabling the bootstrap role.\n   * @dev Caller must be the target factory admin. Reverts on the zero address\n   *      and when the LeafVoter is already set.\n   * @param _leafVoter The LeafVoter on this chain.\n   */\n  function setLeafVoter(address _leafVoter) external;\n\n  /**\n   * @notice Update the target factory admin.\n   * @dev Caller must be the target factory admin. Reverts on the zero address.\n   * @param _targetFactoryAdmin The new target factory admin.\n   */\n  function setTargetFactoryAdmin(address _targetFactoryAdmin) external;\n\n  /**\n   * @notice Remove a gauge factory and its linked target factory from their\n   *         approval sets as a pair. The link and every record the factories\n   *         established keep resolving.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Resolves the target factory through the recorded link. Reverts when\n   *      either factory is not in its approval set.\n   * @param _gaugeFactory The gauge factory of the pair to unregister.\n   */\n  function unregisterFactories(address _gaugeFactory) external;\n\n  /**\n   * @notice Update the TokenRegistry pointer. The registry is a peripheral\n   *         contract that can be replaced, so the pointer is settable.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts on the zero address.\n   * @param _tokenRegistry The new TokenRegistry.\n   */\n  function setTokenRegistry(address _tokenRegistry) external;\n\n  /**\n   * @notice Add a meta router to the approval set. Multiple meta routers can\n   *         be approved at once so older versions keep working while new ones\n   *         roll out.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts on the zero address and a meta router already in the set.\n   * @param _metaRouter The meta router to register.\n   */\n  function registerMetaRouter(address _metaRouter) external;\n\n  /**\n   * @notice Remove a meta router from the approval set.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts when the meta router is not in the set.\n   * @param _metaRouter The meta router to unregister.\n   */\n  function unregisterMetaRouter(address _metaRouter) external;\n\n  /**\n   * @notice Record a freshly deployed target. Called by the target factory\n   *         inside its own creation function.\n   * @dev msg.sender must be a registered target factory, so a factory outside\n   *      the approval set cannot deploy at all. Reverts on the zero address, a\n   *      target already recorded and a target already in the factory\n   *      enumeration.\n   * @param _target The deployed target.\n   */\n  function registerTarget(address _target) external;\n\n  /**\n   * @notice Record a freshly created gauge with its factory, rewards contract\n   *         and target link. Called by the GaugeManager in the creation\n   *         transaction. Writes both sides of the link, which is permanent\n   *         with no later write path.\n   * @dev msg.sender must be the GaugeManager, resolved through the LeafVoter.\n   *      The gauge factory must be\n   *      registered and linked and the target recorded by that factory's\n   *      linked target factory. Reverts on zero addresses, a gauge already recorded or\n   *      enumerated, a rewards contract already recorded and a target already\n   *      linked to a gauge, so the record is write once in every direction.\n   * @param _gauge The deployed gauge.\n   * @param _gaugeFactory The gauge factory that deployed it.\n   * @param _rewards The gauge's rewards contract.\n   * @param _target The target the gauge points at.\n   */\n  function registerGauge(address _gauge, address _gaugeFactory, address _rewards, address _target) external;\n\n  /**\n   * @notice True when the gauge factory is in the approval set.\n   * @param _gaugeFactory The gauge factory to check.\n   * @return _approved Whether the gauge factory is registered.\n   */\n  function isGaugeFactoryApproved(address _gaugeFactory) external view returns (bool _approved);\n\n  /**\n   * @notice True when the target factory is in the approval set.\n   * @param _targetFactory The target factory to check.\n   * @return _approved Whether the target factory is registered.\n   */\n  function isTargetFactoryApproved(address _targetFactory) external view returns (bool _approved);\n\n  /**\n   * @notice True when the meta router is in the approval set. Gauges resolve\n   *         this check to allow a meta router to deposit on behalf of a user.\n   * @param _metaRouter The meta router to check.\n   * @return _approved Whether the meta router is registered.\n   */\n  function isMetaRouterApproved(address _metaRouter) external view returns (bool _approved);\n\n  /**\n   * @notice The registered gauge factories.\n   * @return _factories The gauge factory approval set as an array.\n   */\n  function gaugeFactories() external view returns (address[] memory _factories);\n\n  /**\n   * @notice The number of registered gauge factories.\n   * @return _length The gauge factory approval set member count.\n   */\n  function gaugeFactoriesLength() external view returns (uint256 _length);\n\n  /**\n   * @notice The registered gauge factory at an index.\n   * @param _index The index to read.\n   * @return _factory The member at the index, zero for an out of range index.\n   */\n  function gaugeFactoriesAt(uint256 _index) external view returns (address _factory);\n\n  /**\n   * @notice The registered target factories.\n   * @return _factories The target factory approval set as an array.\n   */\n  function targetFactories() external view returns (address[] memory _factories);\n\n  /**\n   * @notice The number of registered target factories.\n   * @return _length The target factory approval set member count.\n   */\n  function targetFactoriesLength() external view returns (uint256 _length);\n\n  /**\n   * @notice The registered target factory at an index.\n   * @param _index The index to read.\n   * @return _factory The member at the index, zero for an out of range index.\n   */\n  function targetFactoriesAt(uint256 _index) external view returns (address _factory);\n\n  /**\n   * @notice The registered meta routers.\n   * @return _metaRouters The meta router approval set as an array.\n   */\n  function metaRouters() external view returns (address[] memory _metaRouters);\n\n  /**\n   * @notice The targets recorded by a target factory.\n   * @param _factory The target factory to enumerate.\n   * @return _targets The targets the factory deployed as an array.\n   */\n  function factoryToTargets(address _factory) external view returns (address[] memory _targets);\n\n  /**\n   * @notice The number of targets recorded by a target factory.\n   * @param _factory The target factory to enumerate.\n   * @return _length The recorded target count.\n   */\n  function factoryToTargetsLength(address _factory) external view returns (uint256 _length);\n\n  /**\n   * @notice The target recorded by a target factory at an index.\n   * @param _factory The target factory to enumerate.\n   * @param _index The index to read.\n   * @return _target The member at the index, zero for an out of range index.\n   */\n  function factoryToTargetsAt(address _factory, uint256 _index) external view returns (address _target);\n\n  /**\n   * @notice The gauges recorded by a gauge factory.\n   * @param _factory The gauge factory to enumerate.\n   * @return _gauges The gauges the factory deployed as an array.\n   */\n  function factoryToGauges(address _factory) external view returns (address[] memory _gauges);\n\n  /**\n   * @notice The number of gauges recorded by a gauge factory.\n   * @param _factory The gauge factory to enumerate.\n   * @return _length The recorded gauge count.\n   */\n  function factoryToGaugesLength(address _factory) external view returns (uint256 _length);\n\n  /**\n   * @notice The gauge recorded by a gauge factory at an index.\n   * @param _factory The gauge factory to enumerate.\n   * @param _index The index to read.\n   * @return _gauge The member at the index, zero for an out of range index.\n   */\n  function factoryToGaugesAt(address _factory, uint256 _index) external view returns (address _gauge);\n\n  /**\n   * @notice Emission cap for a gauge, read from the factory that deployed it.\n   * @dev Returns zero when the gauge is unknown or the factory call reverts.\n   *      Resolves through the recorded gauge to factory link, so unregistering\n   *      a factory stops new gauges but leaves existing caps intact.\n   * @param _gauge The gauge to resolve.\n   * @return _cap The gauge emission cap in tokens per second.\n   */\n  function emissionCap(address _gauge) external view returns (uint128 _cap);\n\n  /**\n   * @notice LeafVoter on this chain. Resolves roles for every permissioned\n   *         registration function and the GaugeManager for gauge recording.\n   *         Set at construction in a regular deployment. In the lite launch\n   *         it is zero until the target factory admin wires it in through\n   *         setLeafVoter.\n   * @return _leafVoter The LeafVoter address.\n   */\n  function leafVoter() external view returns (address _leafVoter);\n\n  /**\n   * @notice Bootstrap authority of the registry, added for the lite launch\n   *         where the registry deploys before the LeafVoter. Registers target\n   *         factories before the LeafVoter exists and wires the LeafVoter in\n   *         once deployed.\n   * @return _targetFactoryAdmin The target factory admin address, zero once\n   *         the LeafVoter is set.\n   */\n  function targetFactoryAdmin() external view returns (address _targetFactoryAdmin);\n\n  /**\n   * @notice TokenRegistry supplying token listing checks on this chain.\n   * @return _tokenRegistry The current TokenRegistry, zero during a pool-only lite launch until configured.\n   */\n  function tokenRegistry() external view returns (address _tokenRegistry);\n\n  /**\n   * @notice Gauge factory that deployed each gauge. Written once when the\n   *         GaugeManager records the gauge.\n   * @param _gauge The gauge to resolve.\n   * @return _factory The deploying gauge factory, zero for an unknown gauge.\n   */\n  function gaugeToFactory(address _gauge) external view returns (address _factory);\n\n  /**\n   * @notice Target factory that deployed each target. Written once when the\n   *         factory records the target.\n   * @param _target The target to resolve.\n   * @return _factory The deploying target factory, zero for an unknown target.\n   */\n  function targetToFactory(address _target) external view returns (address _factory);\n\n  /**\n   * @notice The target a gauge points at. Written once when the GaugeManager\n   *         records the gauge, with no later write path.\n   * @param _gauge The gauge to resolve.\n   * @return _target The linked target, zero for a gauge with no target.\n   */\n  function gaugeToTarget(address _gauge) external view returns (address _target);\n\n  /**\n   * @notice The gauge over a target. Written once when the GaugeManager\n   *         records the gauge, together with the forward direction, with no\n   *         later write path.\n   * @param _target The target to resolve.\n   * @return _gauge The linked gauge, zero for a target with no gauge.\n   */\n  function targetToGauge(address _target) external view returns (address _gauge);\n\n  /**\n   * @notice The target factory a gauge factory serves. Written once by the\n   *         pair registration entrypoint and never modified afterwards,\n   *         including across reregistration.\n   * @param _gaugeFactory The gauge factory to resolve.\n   * @return _targetFactory The linked target factory, zero for an unlinked factory.\n   */\n  function gaugeFactoryToTargetFactory(address _gaugeFactory) external view returns (address _targetFactory);\n\n  /**\n   * @notice The gauge factory serving a target factory. Written once together\n   *         with the forward direction and never modified afterwards,\n   *         including across reregistration.\n   * @param _targetFactory The target factory to resolve.\n   * @return _gaugeFactory The linked gauge factory, zero for an unlinked factory.\n   */\n  function targetFactoryToGaugeFactory(address _targetFactory) external view returns (address _gaugeFactory);\n\n  /**\n   * @notice Rewards contract escrowing fees and incentives for each gauge.\n   *         Written once when the GaugeManager records the gauge.\n   * @param _gauge The gauge to resolve.\n   * @return _rewards The rewards contract, zero for an unknown gauge.\n   */\n  function gaugeToRewards(address _gauge) external view returns (address _rewards);\n\n  /**\n   * @notice Gauge behind each rewards contract. Written once when the\n   *         GaugeManager records the gauge, together with the forward\n   *         direction. Rewards contracts carry no gauge reference, so this is\n   *         the only on-chain path from a rewards contract back to its gauge.\n   * @param _rewards The rewards contract to resolve.\n   * @return _gauge The recorded gauge, zero for an unknown rewards contract.\n   */\n  function rewardsToGauge(address _rewards) external view returns (address _gauge);\n}\n"},"V3/src/interfaces/factories/IPoolFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IPoolTape} from 'V3/interfaces/pools/tape/IPoolTape.sol';\n\n/**\n * @title IPoolFactory\n * @notice Interface for the PoolFactory contract, the abstract base shared by the Aerodrome V2 volatile and stable pool factories\n */\ninterface IPoolFactory {\n  /// @notice Initial governance roles and modules of a pool factory.\n  /// @dev Every launch installs a pool tape, fee module and exact output fee quoter. Lite launches omit\n  ///      the discount registry and MEV tax module.\n  ///      Factory-bound fee modules and quoters must already be deployed with this factory's address.\n  /// @param poolAdmin Pool administrator.\n  /// @param pauser Factory pauser.\n  /// @param feeManager Manager of fees, fee modules and exact output quoting.\n  /// @param discountRegistryManager Manager of the discount registry.\n  /// @param poolTapeManager Manager of the pool tape.\n  /// @param factoryRegistry Registry that records pools created by this factory.\n  /// @param discountRegistry Initial discount registry, or zero for a lite launch.\n  /// @param poolTape Initial pool tape.\n  /// @param poolTapeGasLimit Nonzero gas forwarded to the pool tape.\n  /// @param feeModule Initial fee module.\n  /// @param feeModuleGasLimit Nonzero gas forwarded to the fee module.\n  /// @param mevTaxModule Initial MEV tax module, or zero for a lite launch.\n  /// @param mevTaxModuleGasLimit Gas forwarded to the MEV tax module; nonzero when it is configured.\n  /// @param exactOutFeeQuoter Initial exact output fee quoter.\n  struct PoolFactoryConfig {\n    address poolAdmin;\n    address pauser;\n    address feeManager;\n    address discountRegistryManager;\n    address poolTapeManager;\n    address factoryRegistry;\n    address discountRegistry;\n    address poolTape;\n    uint32 poolTapeGasLimit;\n    address feeModule;\n    uint32 feeModuleGasLimit;\n    address mevTaxModule;\n    uint32 mevTaxModuleGasLimit;\n    address exactOutFeeQuoter;\n  }\n\n  /*////////////////////////////////////////////////////////////\n                            EVENTS\n  ////////////////////////////////////////////////////////////*/\n  event SetFeeManager(address indexed feeManager);\n  event SetPauser(address indexed pauser);\n  event SetPauseState(bool indexed state);\n  event SetPoolAdmin(address indexed poolAdmin);\n  event PoolCreated(address indexed token0, address indexed token1, address pool, uint256);\n  event SetDefaultFee(uint256 defaultFee);\n  /// @notice Emitted when the fee module and the gas limit forwarded to it are set.\n  /// @param feeModule The new fee module address.\n  /// @param gasLimit The gas limit forwarded to the module on each read.\n  event SetFeeModule(address indexed feeModule, uint32 gasLimit);\n  event SetDiscountRegistryManager(address indexed discountRegistryManager);\n  event SetDiscountRegistry(address indexed discountRegistry);\n\n  /// @notice Emitted when the pool tape module and the gas limit forwarded to it are set.\n  /// @param poolTape The new pool tape address. The zero address disables the pool tape.\n  /// @param gasLimit The gas limit forwarded to the tape on each record.\n  event SetPoolTape(address indexed poolTape, uint32 gasLimit);\n\n  /// @notice Emitted when the pool tape manager is set.\n  /// @param poolTapeManager The new pool tape manager.\n  event SetPoolTapeManager(address indexed poolTapeManager);\n\n  /// @notice Emitted when the MEV tax module and the gas limit forwarded to it are set.\n  /// @param mevTaxModule The new MEV tax module address. The zero address disables the MEV tax.\n  /// @param gasLimit The gas limit forwarded to the module on each read.\n  event SetMevTaxModule(address indexed mevTaxModule, uint32 gasLimit);\n\n  /// @notice Emitted when the exact output fee quoter is set.\n  /// @param exactOutFeeQuoter The new quoter address.\n  event SetExactOutFeeQuoter(address indexed exactOutFeeQuoter);\n\n  /*////////////////////////////////////////////////////////////\n                            ERRORS\n  ////////////////////////////////////////////////////////////*/\n  error FeeTooHigh();\n  /// @notice Reverts when the gas left in the frame is equal to or below the gas limit set for the external call.\n  /// @dev EIP-150 forwards `min(_gasLimit, gasleft() - gasleft() / 64)`, so a transaction that sets its own gas\n  ///      limit too low would leave the callee short. Stopping here keeps the outcome of the call independent of\n  ///      the gas the caller supplied.\n  error InsufficientGasForCall();\n  /// @notice Thrown when the exact output fee quoter being set belongs to another factory.\n  error InvalidExactOutFeeQuoter();\n  error InvalidFeeModule();\n  /// @notice Thrown when an exact output quote is requested while no exact output fee quoter is set.\n  error NoExactOutFeeQuoter();\n  error NotDiscountRegistryManager();\n  error NotFeeManager();\n  error NotPauser();\n  error NotPoolAdmin();\n  /// @notice Thrown when the caller is not the pool tape manager.\n  error NotPoolTapeManager();\n  error PoolAlreadyExists();\n  error SameAddress();\n  error ZeroFee();\n  error ZeroAddress();\n  /// @notice Thrown when a gas limit is set to zero.\n  error ZeroGasLimit();\n\n  /*////////////////////////////////////////////////////////////\n                        EXTERNAL FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Set pool administrator\n  /// @dev Allowed to change the name and symbol of any pool created by this factory\n  /// @param _poolAdmin Address of the pool administrator\n  function setPoolAdmin(address _poolAdmin) external;\n\n  /// @notice Set the pauser for the factory contract\n  /// @dev The pauser can pause swaps on pools associated with the factory. Liquidity will always be withdrawable.\n  /// @dev Must be called by the pauser\n  /// @param _pauser Address of the pauser\n  function setPauser(address _pauser) external;\n\n  /// @notice Set discount registry manager\n  /// @dev The discount registry manager can update the `discountRegistry` variable\n  /// @param _discountRegistryManager Address of the discount registry manager\n  function setDiscountRegistryManager(address _discountRegistryManager) external;\n\n  /// @notice Set the discount registry for the factory contract\n  /// @param _discountRegistry Address of the discount registry\n  function setDiscountRegistry(address _discountRegistry) external;\n\n  /// @notice Pause or unpause swaps on pools associated with the factory\n  /// @param _state True to pause, false to unpause\n  function setPauseState(bool _state) external;\n\n  /// @notice Set the fee manager for the factory contract\n  /// @dev The fee manager can set fees on pools associated with the factory.\n  /// @dev Must be called by the fee manager\n  /// @param _feeManager Address of the fee manager\n  function setFeeManager(address _feeManager) external;\n\n  /// @notice Updates the feeModule of the factory and the gas limit forwarded to it\n  /// @dev Must be called by the current fee manager. Reverts if the gas limit set is zero.\n  /// @param _feeModule The new feeModule of the factory\n  /// @param _gasLimit The gas limit forwarded to the module on each read. Calculated as\n  ///        `(usage + buffer) * 64 / 63` where `usage` is the most gas the module can spend and `buffer` is what\n  ///        this factory spends checking the gas and dispatching the call. The `64 / 63` covers the share\n  ///        EIP-150 withholds from the callee.\n  function setFeeModule(address _feeModule, uint32 _gasLimit) external;\n\n  /// @notice Set the default fee for pools created by this factory.\n  /// @dev Throws if higher than maximum fee.\n  ///      Throws if fee is zero.\n  /// @param _defaultFee .\n  function setDefaultFee(uint256 _defaultFee) external;\n\n  /// @notice Create a pool for the given pair of tokens\n  /// @dev token order does not matter\n  /// @param tokenA .\n  /// @param tokenB .\n  function createPool(address tokenA, address tokenB) external returns (address pool);\n\n  /// @notice Sets the pool tape manager role that controls the pool tape configuration.\n  /// @dev Must be called by the current pool tape manager. The initial manager is set in the constructor.\n  /// @param _poolTapeManager Address of the new pool tape manager.\n  function setPoolTapeManager(address _poolTapeManager) external;\n\n  /// @notice Sets or clears the pool tape module that the pool records data into, and the gas limit sent to it.\n  /// @dev Must be called by the pool tape manager. The zero address disables the pool tape recording.\n  /// @dev Reverts if the gas limit set is zero.\n  /// @param _poolTape Address of the pool tape module.\n  /// @param _gasLimit The gas limit forwarded to the tape on each record. Calculated as\n  ///        `(usage + buffer) * 64 / 63` where `usage` is the most gas the tape can spend and `buffer` is what\n  ///        this factory spends checking the gas and dispatching the call. The `64 / 63` covers the share\n  ///        EIP-150 withholds from the callee.\n  function setPoolTape(address _poolTape, uint32 _gasLimit) external;\n\n  /// @notice Sets or clears the MEV tax module queried for the MEV tax on swaps, and the gas limit sent to it.\n  /// @dev Must be called by the fee manager. The zero address disables the MEV tax.\n  /// @dev Reverts if the gas limit set is zero.\n  /// @param _mevTaxModule Address of the MEV tax module.\n  /// @param _gasLimit The gas limit forwarded to the module on each read. Calculated as\n  ///        `(usage + buffer) * 64 / 63` where `usage` is the most gas the module can spend and `buffer` is what\n  ///        this factory spends checking the gas and dispatching the call. The `64 / 63` covers the share\n  ///        EIP-150 withholds from the callee.\n  function setMevTaxModule(address _mevTaxModule, uint32 _gasLimit) external;\n\n  /// @notice Sets the quoter that resolves the fee of exact output quotes.\n  /// @dev Must be called by the fee manager. Reverts on the zero address and when the quoter belongs to another\n  ///      factory. Exact output quotes revert until a quoter is set.\n  /// @param _exactOutFeeQuoter Address of the exact output fee quoter.\n  function setExactOutFeeQuoter(address _exactOutFeeQuoter) external;\n\n  /// @notice Forwards a pool's per-swap deltas to the pool tape, if one is set.\n  /// @param _data The per-swap deltas to record.\n  function recordPoolTape(IPoolTape.PoolTapeData calldata _data) external;\n\n  /*////////////////////////////////////////////////////////////\n                      PURE AND VIEW FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Return a single pool created by this factory\n  /// @return Address of pool\n  function allPools(uint256 index) external view returns (address);\n\n  /// @notice Returns all pools created by this factory\n  /// @return Array of pool addresses\n  function allPools() external view returns (address[] memory);\n\n  /// @notice Returns the number of pools created from this factory\n  function allPoolsLength() external view returns (uint256);\n\n  /// @notice Is a valid pool created by this factory.\n  /// @param pool .\n  function isPool(address pool) external view returns (bool);\n\n  /// @notice Return address of pool created by this factory\n  /// @param tokenA .\n  /// @param tokenB .\n  function getPool(address tokenA, address tokenB) external view returns (address);\n\n  /// @notice Returns the base fee for a pool swap, accounting for custom fees set via the fee module.\n  /// @dev A fee module value above `MAX_BASE_FEE` is ignored, falling back to `defaultFee`.\n  /// @param _pool The pool to get the base fee for.\n  /// @param _caller The swap initiator.\n  /// @param _amount0In The token0 input amount of the swap, zero when token0 is not an input.\n  /// @param _amount1In The token1 input amount of the swap, zero when token1 is not an input.\n  /// @param _reserve0 The pre-swap token0 reserve of the pool.\n  /// @param _reserve1 The pre-swap token1 reserve of the pool.\n  /// @return The base fee in basis points.\n  function getBaseFee(\n    address _pool,\n    address _caller,\n    uint256 _amount0In,\n    uint256 _amount1In,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256);\n\n  /// @notice Returns the swap fee data for a pool swap, including the MEV tax.\n  /// @dev The MEV tax is clamped so the total stays at or below `MAX_FEE`.\n  /// @param _pool The pool to get the fee for.\n  /// @param _sender The swap caller, the pool's msg.sender.\n  /// @param _amount0In The token0 input amount of the swap, zero when token0 is not an input.\n  /// @param _amount1In The token1 input amount of the swap, zero when token1 is not an input.\n  /// @param _reserve0 The pre-swap token0 reserve of the pool.\n  /// @param _reserve1 The pre-swap token1 reserve of the pool.\n  /// @return _fee The combined swap fee in basis points.\n  /// @return _mevFee The MEV share of the fee in basis points, rounded up.\n  /// @return _toxic True when the swap is classified as toxic flow.\n  function getFee(\n    address _pool,\n    address _sender,\n    uint256 _amount0In,\n    uint256 _amount1In,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256 _fee, uint256 _mevFee, bool _toxic);\n\n  /// @notice Returns the total fee to gross up an exact output quote with, given the input the curve requires.\n  /// @dev Reverts with `NoExactOutFeeQuoter` while no quoter is set and with `FeeTooHigh` when the quoter\n  ///      answers above `MAX_FEE`.\n  /// @param _pool The pool to get the fee for.\n  /// @param _caller The swap initiator.\n  /// @param _amount0InAfterFee The token0 input the curve requires after the fee, zero when token0 is not an input.\n  /// @param _amount1InAfterFee The token1 input the curve requires after the fee, zero when token1 is not an input.\n  /// @param _reserve0 The pre-swap token0 reserve of the pool.\n  /// @param _reserve1 The pre-swap token1 reserve of the pool.\n  /// @return _fee The total fee in basis points.\n  function getFeeForAmountIn(\n    address _pool,\n    address _caller,\n    uint256 _amount0InAfterFee,\n    uint256 _amount1InAfterFee,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256 _fee);\n\n  /// @notice The pool implementation used to create pools\n  /// @return Address of pool implementation\n  function implementation() external view returns (address);\n\n  /// @notice The factory registry every created pool is recorded in as a target.\n  /// @dev Set at construction. createPool reverts until this factory is an approved\n  ///      target factory in the registry.\n  /// @return Address of the factory registry.\n  function factoryRegistry() external view returns (address);\n\n  /// @notice Whether the pools associated with the factory are paused or not.\n  /// @dev Pause only pauses swaps, liquidity will always be withdrawable.\n  function isPaused() external view returns (bool);\n\n  /// @notice The address of the pauser, can pause swaps on pools associated with factory.\n  /// @return Address of the pauser\n  function pauser() external view returns (address);\n\n  /// @notice The default fee for pools created by this factory.\n  /// @return Default fee\n  function defaultFee() external view returns (uint256);\n\n  /// @notice Hard-coded default fee value the factory variant is initialized with\n  /// @dev Constant per variant. The mutable current value lives in `defaultFee()`.\n  function DEFAULT_FEE() external view returns (uint256);\n\n  /// @notice Maximum default fee the fee manager can set\n  /// @return 3% in bips\n  function MAX_DEFAULT_FEE() external view returns (uint256);\n\n  /// @notice Maximum base fee the factory accepts from the fee module\n  /// @return 10% in bips\n  function MAX_BASE_FEE() external view returns (uint256);\n\n  /// @notice Maximum total fee a swap can be charged, base fee plus MEV tax\n  /// @return 20% in bips\n  function MAX_FEE() external view returns (uint256);\n\n  /// @notice Address of the fee manager, can set fees on pools associated with factory.\n  /// @notice This overrides the default fee for that pool.\n  /// @return Address of the fee manager\n  function feeManager() external view returns (address);\n\n  /// @notice Address of the fee module of the factory\n  /// @dev Can be changed by the current fee manager via setFeeModule\n  /// @return Address of the fee module\n  function feeModule() external view returns (address);\n\n  /// @notice The gas limit forwarded to the fee module on each read.\n  /// @return _gasLimit The gas limit.\n  function feeModuleGasLimit() external view returns (uint32 _gasLimit);\n\n  /// @notice Address of the pool administrator, can change the name and symbol of pools created by factory.\n  /// @return Address of the pool administrator\n  function poolAdmin() external view returns (address);\n\n  /// @notice Address of the discount registry manager, can update the `discountRegistry` variable\n  /// @return Address of the discount registry manager\n  function discountRegistryManager() external view returns (address);\n\n  /// @notice Address of the discount registry, that allows querying swap fee discounts\n  /// @return Address of the discount registry\n  function discountRegistry() external view returns (address);\n\n  /// @notice The pool tape module that pools record into. The zero address means recording is disabled.\n  /// @return Address of the pool tape module.\n  function poolTape() external view returns (address);\n\n  /// @notice The gas limit forwarded to the pool tape on each record.\n  /// @return _gasLimit The gas limit.\n  function poolTapeGasLimit() external view returns (uint32 _gasLimit);\n\n  /// @notice The pool tape manager, which controls the pool tape configuration.\n  /// @return Address of the pool tape manager.\n  function poolTapeManager() external view returns (address);\n\n  /// @notice The MEV tax module queried to get the mev tax for a swap. The zero address means the MEV tax is disabled.\n  /// @return Address of the MEV tax module.\n  function mevTaxModule() external view returns (address);\n\n  /// @notice The gas limit forwarded to the MEV tax module on each read.\n  /// @return _gasLimit The gas limit.\n  function mevTaxModuleGasLimit() external view returns (uint32 _gasLimit);\n\n  /// @notice The quoter that resolves the fee of exact output quotes. Exact output quotes revert while unset.\n  /// @return Address of the exact output fee quoter.\n  function exactOutFeeQuoter() external view returns (address);\n}\n"},"V3/src/interfaces/metarouter/IMetarouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IInterchainAccountRouter} from 'V3/interfaces/external/IInterchainAccountRouter.sol';\nimport {IWETH} from 'V3/interfaces/external/IWETH.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IRelayFactoryRegistry} from 'V3/interfaces/relay/IRelayFactoryRegistry.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title IMetarouter\n * @notice External surface, errors and events for the Metarouter and its command groups.\n */\ninterface IMetarouter {\n  // ============================== Types ==============================\n\n  /**\n   * @notice How a command spends an asset balance available to the execution address.\n   * @param Amount Spend an exact asset amount.\n   * @param Pips Spend a fraction of the current balance expressed in millionths.\n   */\n  enum SpendMode {\n    Amount,\n    Pips\n  }\n\n  /**\n   * @notice Selects how much of an execution-address asset balance a command spends.\n   * @param mode Balance-resolution mode.\n   * @param value Exact asset amount for `Amount`, or pip value for `Pips`.\n   */\n  struct BalanceSpend {\n    SpendMode mode;\n    uint256 value;\n  }\n\n  /**\n   * @notice Inputs for an exact-input V2 or CL swap command.\n   * @param pools Forward-ordered pools in the swap route.\n   * @param tokenIn Input token for the first pool.\n   * @param amountIn Input balance specification.\n   * @param payerIsUser Whether the execution owner funds the route input.\n   * @param minAmountOut Minimum output the recipient must receive. On V2 routes the bound is enforced against both\n   *        the router's own quote of the final hop and the recipient's balance delta; on CL routes it is enforced\n   *        against the pool-reported output.\n   * @param recipient Address that receives the final output.\n   */\n  struct SwapExactInParams {\n    address[] pools;\n    address tokenIn;\n    BalanceSpend amountIn;\n    bool payerIsUser;\n    uint256 minAmountOut;\n    address recipient;\n  }\n\n  /**\n   * @notice Inputs for an exact-output V2 or CL swap command.\n   * @param pools Forward-ordered pools in the swap route.\n   * @param tokenIn Input token for the first pool.\n   * @param amountOut Exact output the recipient must receive.\n   * @param payerIsUser Whether the execution owner funds the route input.\n   * @param maxAmountIn Maximum input the payer may spend.\n   * @param recipient Address that receives the final output.\n   */\n  struct SwapExactOutParams {\n    address[] pools;\n    address tokenIn;\n    uint256 amountOut;\n    bool payerIsUser;\n    uint256 maxAmountIn;\n    address recipient;\n  }\n\n  /**\n   * @notice Settlement authorization forwarded to the active CL swap callback.\n   * @dev With no remaining pools the payer settles the invoice directly; otherwise the callback swaps the previous\n   *      route pool for the exact invoiced amount, recursing hop by hop until the first pool is paid.\n   * @param pools Route pools, of which only the first `remaining` are still unexecuted.\n   * @param zeroForOne Whether token0 is exchanged for token1 for each route pool.\n   * @param remaining Number of unexecuted route pools left before the payer settles directly.\n   * @param tokenIn Token the payer owes.\n   * @param payer Address authorized to pay.\n   * @param maxAmountIn Maximum token input the payer may transfer.\n   */\n  struct ClSwapCallbackData {\n    address[] pools;\n    bool[] zeroForOne;\n    uint256 remaining;\n    address tokenIn;\n    address payer;\n    uint256 maxAmountIn;\n  }\n\n  /**\n   * @notice Selects the destination Hyperlane interchain account configuration used by a cross-chain command.\n   * @dev An empty configuration (`router == address(0)` and `ism == address(0)`) resolves both values from the\n   *      interchain account router's enrolled defaults. A non-zero `router` selects a custom preserved\n   *      configuration, where a zero `ism` intentionally delegates verification to Hyperlane's default ISM while\n   *      remaining zero in the account derivation.\n   * @param router Custom destination interchain account router, or zero to use the enrolled configuration.\n   * @param ism Custom destination interchain security module; may be zero when `router` is non-zero.\n   */\n  struct IcaConfig {\n    address router;\n    address ism;\n  }\n\n  /**\n   * @notice Inputs for the `BRIDGE_TOKEN` command.\n   * @param token Token being bridged, or zero for native.\n   * @param bridge Caller-selected Warp Route.\n   * @param spend Balance selection funding the bridge.\n   * @param messageFee Native message fee for an ERC20 bridge; zero when the route charges interchain gas in its own\n   *        token, since that gas paymaster rejects native value.\n   * @param maxFee Maximum accepted token-denominated bridge fee: an absolute token amount for `Amount`, or a fraction\n   *        of the resolved bridge amount in millionths, rounded up, for `Pips`.\n   * @param domain Destination Hyperlane domain.\n   * @param recipient Destination recipient, the zero address derives the logical sender's interchain account.\n   * @param icaConfig Optional custom destination ICA router and ISM.\n   * @param targetRouter Destination token router for an explicit cross-collateral route, or zero for the source\n   *        router's enrolled route to `domain`.\n   */\n  struct BridgeTokenParams {\n    address token;\n    address bridge;\n    BalanceSpend spend;\n    uint256 messageFee;\n    BalanceSpend maxFee;\n    uint32 domain;\n    address recipient;\n    IcaConfig icaConfig;\n    bytes32 targetRouter;\n  }\n\n  /**\n   * @notice Inputs for the `EXECUTE_CROSS_CHAIN` command.\n   * @param domain Destination Hyperlane domain.\n   * @param commitment Commitment to the destination calls.\n   * @param messageFee Native message fee forwarded to Hyperlane.\n   * @param tokenFee Maximum fee-token approval granted to Hyperlane.\n   * @param hook Post-dispatch hook.\n   * @param hookMetadata Metadata forwarded to the post-dispatch hook.\n   * @param icaConfig Optional custom destination ICA router and ISM.\n   */\n  struct ExecuteCrosschainParams {\n    uint32 domain;\n    bytes32 commitment;\n    uint256 messageFee;\n    uint256 tokenFee;\n    address hook;\n    bytes hookMetadata;\n    IcaConfig icaConfig;\n  }\n\n  /**\n   * @notice Inputs for the `REDEEM` command.\n   * @param spend Balance selection funding the redeem from the held `ReceiptToken`.\n   * @param payerIsUser Whether to pull an exact `ReceiptToken` amount from the logical sender instead of the execution\n   *        balance.\n   * @param recipient Address that receives the minted `TOKEN` on root. The leaf cannot inspect that address on root or\n   *        determine whether it safely accounts for deposits. In particular, `TOKEN` sent to a permissionless\n   *        Metarouter can be swept by any caller, with no privileged recovery right for the redeemer.\n   * @param gasLimit Execution gas reserved for the destination handler; the transport rejects zero.\n   * @param refundRecipient Address the transport refunds the unspent `messageFee` to, or zero to name the Metarouter,\n   *        which returns the excess with the batch's other unused funds. Name an address instead when the batch caller\n   *        cannot receive native, since the closing refund reverts the batch in that case.\n   * @param messageFee Native message fee forwarded to the dispatch.\n   */\n  struct RedeemParams {\n    BalanceSpend spend;\n    bool payerIsUser;\n    address recipient;\n    uint256 gasLimit;\n    address refundRecipient;\n    uint256 messageFee;\n  }\n\n  /**\n   * @notice Arguments of a `MINT_CL_POSITION` command; the two pool tokens are funded independently before the mint.\n   * @dev `token0`/`token1` must be sorted ascending, the ordering the position manager expects.\n   * @param factory Protocol CL factory whose canonical position manager mints the position. Current approval is\n   *        required only when creating a pool.\n   * @param token0 First pool token, sorted ascending.\n   * @param token1 Second pool token, sorted ascending.\n   * @param tickSpacing Tick spacing identifying the pool alongside its tokens.\n   * @param tickLower Lower tick of the position range.\n   * @param tickUpper Upper tick of the position range.\n   * @param spend0 Selection applied when funding `token0`.\n   * @param spend1 Selection applied when funding `token1`.\n   * @param payerIsUser0 Whether to pull an exact `token0` amount from the logical sender instead of the execution\n   *        balance.\n   * @param payerIsUser1 Whether to pull an exact `token1` amount from the logical sender instead of the execution\n   *        balance.\n   * @param amount0Min Minimum `token0` contributed, as a slippage bound.\n   * @param amount1Min Minimum `token1` contributed, as a slippage bound.\n   * @param recipient Address the minted position goes to; set it to the metarouter to keep the position in flight for a\n   *        later command.\n   * @param sqrtPriceX96 Nonzero requests pool creation at this price and requires current factory approval; zero uses\n   *        an existing pool.\n   * @param deadline Timestamp after which the mint reverts.\n   */\n  struct MintClParams {\n    address factory;\n    address token0;\n    address token1;\n    int24 tickSpacing;\n    int24 tickLower;\n    int24 tickUpper;\n    BalanceSpend spend0;\n    BalanceSpend spend1;\n    bool payerIsUser0;\n    bool payerIsUser1;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    address recipient;\n    uint160 sqrtPriceX96;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Arguments of an `INCREASE_CL_LIQUIDITY` command; the position's tokens are funded independently before the\n   *         increase.\n   * @dev The position's `token0`/`token1` are read from the position manager, so only the funding selection is passed.\n   * @param factory Protocol CL factory whose canonical position manager holds the position, including a retired factory.\n   * @param tokenId Position to add liquidity to, or zero to use the in-flight position.\n   * @param spend0 Selection applied when funding the position's `token0`.\n   * @param spend1 Selection applied when funding the position's `token1`.\n   * @param payerIsUser0 Whether to pull an exact `token0` amount from the logical sender instead of the execution\n   *        balance.\n   * @param payerIsUser1 Whether to pull an exact `token1` amount from the logical sender instead of the execution\n   *        balance.\n   * @param amount0Min Minimum `token0` contributed, as a slippage bound.\n   * @param amount1Min Minimum `token1` contributed, as a slippage bound.\n   * @param deadline Timestamp after which the increase reverts.\n   */\n  struct IncreaseClParams {\n    address factory;\n    uint256 tokenId;\n    BalanceSpend spend0;\n    BalanceSpend spend1;\n    bool payerIsUser0;\n    bool payerIsUser1;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Inputs for the ADD_LIQUIDITY command.\n   * @param factory Pool factory that resolves, or creates, the pair's stable or volatile pool. Current factory\n   *        approval is required only when creating a pool.\n   * @param tokenA First token supplied by the caller. All fields ending in `A` refer to this token, regardless of the\n   *        pool's canonical token order.\n   * @param tokenB Second token supplied by the caller. All fields ending in `B` refer to this token.\n   * @param createPool Whether a missing pool may be created; when false a pair with no pool reverts with\n   *        `PoolNotFound`.\n   * @param spendA Balance selection funding tokenA.\n   * @param spendB Balance selection funding tokenB.\n   * @param payerAIsUser Whether tokenA is pulled from the logical sender as an exact amount instead of the execution\n   *        balance.\n   * @param payerBIsUser Whether tokenB is pulled from the logical sender as an exact amount instead of the execution\n   *        balance.\n   * @param amountAMin Minimum tokenA the router commits to the pool after the optimal-amount trim. A fee-on-transfer\n   *        token is not rejected, but the minimum bounds what the router commits, not what the pool receives, so the\n   *        guarantee does not hold for it.\n   * @param amountBMin Minimum tokenB the router commits to the pool after the optimal-amount trim. A fee-on-transfer\n   *        token is not rejected, but the minimum bounds what the router commits, not what the pool receives, so the\n   *        guarantee does not hold for it.\n   * @param recipient Address the minted LP tokens are sent to.\n   * @param liquidityMin Minimum LP tokens the pool must mint for the deposit. The pool mints from its received\n   *        balances, so unlike the per-token minimums this bound holds even for a fee-on-transfer token. Zero disables\n   *        this router-level bound; the pool still rejects a zero-liquidity mint.\n   */\n  struct AddLiquidityParams {\n    address factory;\n    address tokenA;\n    address tokenB;\n    bool createPool;\n    BalanceSpend spendA;\n    BalanceSpend spendB;\n    bool payerAIsUser;\n    bool payerBIsUser;\n    uint256 amountAMin;\n    uint256 amountBMin;\n    address recipient;\n    uint256 liquidityMin;\n  }\n\n  /**\n   * @notice Inputs for the REMOVE_LIQUIDITY command.\n   * @param pool Registered V2 pool whose LP tokens are burned; the pool contract is its own LP token.\n   * @param lpSpend Balance selection funding the LP amount to burn.\n   * @param payerIsUser Whether the LP is pulled from the logical sender as an exact amount instead of the execution\n   *        balance.\n   * @param amount0Min Minimum token0 the burn reports returning. A fee-on-transfer token is not rejected, but the\n   *        minimum bounds what the burn reports, not what the recipient receives, so the guarantee does not hold\n   *        for it.\n   * @param amount1Min Minimum token1 the burn reports returning. A fee-on-transfer token is not rejected, but the\n   *        minimum bounds what the burn reports, not what the recipient receives, so the guarantee does not hold\n   *        for it.\n   * @param recipient Address the underlying token0/token1 are sent to.\n   */\n  struct RemoveLiquidityParams {\n    address pool;\n    BalanceSpend lpSpend;\n    bool payerIsUser;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    address recipient;\n  }\n\n  // ============================== Events ==============================\n\n  /**\n   * @notice Emitted when the outermost frame of a batch completes.\n   * @param _sender Logical sender that owned the completed batch.\n   */\n  event BatchExecuted(address indexed _sender);\n\n  // ============================== Errors ==============================\n\n  /// @notice Thrown when an inbound asset reaches the router outside a batch.\n  error BatchNotActive();\n\n  /**\n   * @notice Thrown when a command depends on a protocol contract this deployment was built without.\n   * @param _commandType Command ID that is disabled on this deployment.\n   */\n  error CommandDisabled(uint256 _commandType);\n\n  /// @notice Thrown when an external caller enters `execute()` while a batch is running.\n  error ContractLocked();\n\n  /// @notice Thrown when Metarouter is reached through delegatecall instead of a direct call.\n  error DirectCallRequired();\n\n  /// @notice Thrown when the batch deadline has passed.\n  error Expired();\n\n  /**\n   * @notice Thrown when a command byte decodes to an undefined command ID.\n   * @param _commandType Undefined command ID that was dispatched.\n   */\n  error InvalidCommandType(uint256 _commandType);\n\n  /// @notice Thrown when ETH arrives from an unexpected sender outside a batch.\n  error InvalidEthSender();\n\n  /// @notice Thrown when a batch spends native ETH held before that batch started.\n  error PreBatchNativeBalanceSpent();\n\n  /// @notice Thrown when the router's native balance differs from its pre-batch balance after the closing refund.\n  error NativeBalanceNotCleared();\n\n  /**\n   * @notice Thrown when a native ETH transfer fails, bubbling the callee's revert data.\n   * @param _data Revert data returned by the failed low-level call.\n   */\n  error NativeTransferFailed(bytes _data);\n\n  /**\n   * @notice Thrown when the execution-address balance cannot cover a spend or minimum floor.\n   * @param _asset ERC20 address, or address(0) for native ETH.\n   */\n  error InsufficientBalance(address _asset);\n\n  /// @notice Thrown when a liquidity command's resolved token0 amount falls below its minimum.\n  error InsufficientAmount0();\n\n  /// @notice Thrown when a liquidity command's resolved token1 amount falls below its minimum.\n  error InsufficientAmount1();\n\n  /// @notice Thrown when an add-liquidity command's resolved tokenA amount falls below its minimum.\n  error InsufficientAmountA();\n\n  /// @notice Thrown when an add-liquidity command's resolved tokenB amount falls below its minimum.\n  error InsufficientAmountB();\n\n  /**\n   * @notice Thrown when an add-liquidity command mints fewer LP tokens than requested.\n   * @param _minimum Minimum LP tokens requested by the caller.\n   * @param _minted LP tokens minted by the pool.\n   */\n  error InsufficientLiquidityMinted(uint256 _minimum, uint256 _minted);\n\n  /// @notice Thrown when the commands and inputs arrays differ in length.\n  error LengthMismatch();\n\n  /// @notice Thrown when an external pull uses a router-balance spend mode.\n  error InvalidSpendMode();\n\n  /**\n   * @notice Thrown when a pip spend exceeds 100%.\n   * @param _pips Pip value that exceeded the 100% denominator.\n   */\n  error InvalidPips(uint256 _pips);\n\n  /// @notice Thrown when a payment command names an invalid recipient.\n  error InvalidRecipient();\n\n  /// @notice Thrown when a claim or stake targets a gauge not registered with the Voter.\n  error GaugeNotRegistered();\n\n  /// @notice Thrown when a routed V2 gauge claim or withdrawal would incur a penalty without explicit user consent.\n  error PenaltyNotAccepted();\n\n  /// @notice Thrown when position ids are supplied for a gauge that does not support position-level claims.\n  error InvalidGaugeType();\n\n  /// @notice Thrown when an NFT arrives from a collection other than the one the active command solicited.\n  error InvalidNftSender();\n\n  /// @notice Thrown when a position arrives from a sender the active command did not solicit it from.\n  error UnexpectedNftSender();\n\n  /// @notice Thrown when a command would arm an expected NFT sender while another authorization is still pending.\n  error NftSenderNotCleared();\n\n  /// @notice Thrown when a gauge withdrawal returns without delivering the requested position through the receiver.\n  error NftNotReceived();\n\n  /// @notice Thrown when a command would operate a router-held NFT that did not enter custody during the active batch.\n  error NftNotInCustody();\n\n  /// @notice Thrown when a tracked NFT still belongs to the router at batch closure.\n  error NftNotCleared();\n\n  /**\n   * @notice Thrown when a producer command would leave a second NFT in flight before the first is consumed.\n   */\n  error InFlightNftPresent();\n\n  /// @notice Thrown when a command references the in-flight NFT but none of the expected collection is in flight.\n  error NoInFlightNft();\n\n  /// @notice Thrown when a CL position command targets a position the logical sender does not own.\n  error NotPositionOwner();\n\n  /// @notice Thrown when a V2 liquidity command or fee claim targets a pool without a FactoryRegistry creation record.\n  error PoolNotRegistered();\n\n  /// @notice Thrown when an operation requiring current target-factory approval selects an unapproved factory.\n  error FactoryNotApproved();\n\n  /**\n   * @notice Thrown when no record names a factory's position manager: the factory getter returns the zero address,\n   *         or it reverts and the registry pairs the factory with no gauge factory, or the paired gauge factory\n   *         binds the zero address.\n   * @param _factory Factory whose position manager is unset.\n   */\n  error PositionManagerNotConfigured(address _factory);\n\n  /**\n   * @notice Thrown when the position manager a factory names does not point back at that factory.\n   * @param _factory Factory that named the manager.\n   * @param _positionManager Position manager that failed the reverse-link check.\n   */\n  error PositionManagerFactoryMismatch(address _factory, address _positionManager);\n\n  /**\n   * @notice Thrown when a gauge reports a factory other than the one permanently recorded for it.\n   * @param _gauge Gauge whose factory identity is inconsistent.\n   * @param _recordedFactory Gauge factory recorded by the FactoryRegistry.\n   * @param _reportedFactory Gauge factory reported by the gauge itself.\n   */\n  error GaugeFactoryMismatch(address _gauge, address _recordedFactory, address _reportedFactory);\n\n  /**\n   * @notice Thrown when the factory resolves a pool that does not hold the requested token pair.\n   * @param _pool Resolved pool address.\n   */\n  error PoolTokenMismatch(address _pool);\n\n  /// @notice Thrown when the pair has no pool and the command may not create one.\n  error PoolNotFound();\n\n  /**\n   * @notice Thrown when a root-only command (sAERO creation or relay deposit) runs on a leaf deployment.\n   * @param _commandType Command ID that is root-only.\n   */\n  error NotRoot(uint256 _commandType);\n\n  /**\n   * @notice Thrown when a leaf-only command (redeem) runs on the root deployment.\n   * @param _commandType Command ID that is leaf-only.\n   */\n  error NotLeaf(uint256 _commandType);\n\n  /**\n   * @notice Thrown when a relay deposit targets an address whose reported factory the RelayFactoryRegistry does not\n   *         approve, or which that factory did not create.\n   */\n  error UnauthorizedRelay();\n\n  /**\n   * @notice Thrown when a relay reports a VoterPaymentsModule the staking escrow does not recognize (it lacks\n   *         `VPM_ROLE`), so the router refuses to grant it the operator approval a deposit needs.\n   */\n  error UnauthorizedRelayVpm();\n\n  /// @notice Thrown when a constructor dependency is the zero address.\n  error ZeroAddress();\n\n  /// @notice Thrown when the native ERC20 reports more decimals than the native asset's eighteen.\n  error InvalidNativeErc20Decimals();\n\n  /// @notice Thrown when the wrapped native token and the native ERC20 are the same address.\n  error WethIsNativeErc20();\n\n  /// @notice Thrown when a command resolves a zero asset amount to act on.\n  error ZeroAmount();\n\n  /// @notice Thrown when a cross-chain dispatch targets a domain with no interchain account router enrolled.\n  error UnregisteredDomain();\n\n  /// @notice Thrown when an interchain account configuration names an ISM without a custom destination router.\n  error InvalidInterchainAccountConfig();\n\n  /// @notice Thrown when a warp route's token fee exceeds the caller's accepted maximum.\n  error TokenFeeExceedsMax();\n\n  /**\n   * @notice Thrown when a warp route's token fee equals or exceeds the amount being bridged, leaving nothing to\n   *         deliver.\n   */\n  error TokenFeeExceedsAmount();\n\n  /**\n   * @notice Thrown when a caller-selected warp route quotes a total charge below the amount being bridged, which no\n   *         honest route reports because the charge covers the delivered amount itself.\n   */\n  error InvalidBridgeQuote();\n\n  /**\n   * @notice Thrown when a native warp route quotes the reduced bridge amount above the resolved budget.\n   * @param _quote Native total the route quotes for the reduced bridge amount.\n   * @param _budget Native budget resolved for the bridge.\n   */\n  error BridgeQuoteExceedsBudget(uint256 _quote, uint256 _budget);\n\n  /**\n   * @notice Thrown when the caller-selected warp route does not manage the token being bridged: the route's `token()`\n   *         does not equal the command's token, so it would pull or burn a different asset than the router approved.\n   *         Guards an honest token/route mismatch; an untrusted route can still misreport, so this is not route trust.\n   */\n  error BridgeTokenMismatch();\n\n  /// @notice Thrown when explicit cross-collateral routing is requested with the zero-address native-token marker.\n  error UnsupportedCrossCollateralToken();\n\n  /// @notice Thrown when explicit cross-collateral routing targets the origin domain's synchronous transfer path.\n  error SameDomainCrossCollateralTransfer();\n\n  /**\n   * @notice Thrown when a bridge quote includes a nonzero fee in a token other than the source token or native\n   *         currency.\n   * @param _token Address of the unsupported fee token.\n   */\n  error UnsupportedBridgeFeeToken(address _token);\n\n  /// @notice Thrown when a cross-chain dispatch's hook metadata carries no refund address.\n  error InvalidHookMetadata();\n\n  /// @notice Thrown when an amount cannot be represented as a signed CL swap amount.\n  error AmountOverflow();\n\n  /**\n   * @notice Thrown when a CL pool returns without consuming its callback authorization.\n   * @param _pool Pool still stored as the expected callback caller.\n   */\n  error CallbackNotCleared(address _pool);\n\n  /// @notice Thrown when an exact-output swap delivers a different output than the requested amount.\n  error InvalidAmountOut();\n\n  /// @notice Thrown when a callback does not contain exactly one positive token delta.\n  error InvalidCallbackDeltas();\n\n  /**\n   * @notice Thrown when a caller is not the currently authorized CL pool.\n   * @param _caller Unauthorized callback caller.\n   */\n  error InvalidCallbackCaller(address _caller);\n\n  /// @notice Thrown when a pool path is empty or its adjacent tokens do not connect.\n  error InvalidPath();\n\n  /// @notice Thrown when a payer is neither the execution address nor the logical sender.\n  error InvalidPayer();\n\n  /**\n   * @notice Thrown when a pool has no recorded factory, its recorded factory does not authenticate it or differs\n   *         from the supplied factory, or its pool family is unsupported for the command.\n   * @param _pool Invalid pool address.\n   */\n  error InvalidPool(address _pool);\n\n  /**\n   * @notice Thrown when a V2 pool's token balance is below its recorded input reserve.\n   * @param _pool Pool with invalid reserves.\n   */\n  error InvalidReserves(address _pool);\n\n  /// @notice Thrown when a CL swap reports a positive output-token delta.\n  error InvalidSwapDeltas();\n\n  /**\n   * @notice Thrown when an exact-input swap receives less than its minimum.\n   * @param _minimum Minimum output requested.\n   * @param _received Actual output received.\n   */\n  error TooLittleReceived(uint256 _minimum, uint256 _received);\n\n  /// @notice Thrown when a swap requires more input than the command authorized.\n  error TooMuchRequested();\n\n  // ============================== Functions ==============================\n\n  /**\n   * @notice Runs an ordered command batch as one atomic call.\n   * @param _commands One byte per command, index-aligned with `_inputs`.\n   * @param _inputs ABI-encoded arguments for each command.\n   * @param _deadline Timestamp after which the batch reverts.\n   */\n  function execute(bytes calldata _commands, bytes[] calldata _inputs, uint256 _deadline) external payable;\n\n  /**\n   * @notice Pays the input token owed to the currently authenticated CL pool.\n   * @param _amount0Delta Signed token0 amount owed to or sent by the pool.\n   * @param _amount1Delta Signed token1 amount owed to or sent by the pool.\n   * @param _data Callback payer and input authorization encoded by the active swap command.\n   */\n  function uniswapV3SwapCallback(int256 _amount0Delta, int256 _amount1Delta, bytes calldata _data) external;\n\n  /**\n   * @notice Returns the account whose positions and approvals commands act for.\n   * @return _sender Logical sender for the current batch.\n   */\n  function msgSender() external view returns (address _sender);\n\n  // ============================== Variable getters ==============================\n\n  /**\n   * @notice Wrapped native token used by wrap and unwrap commands.\n   * @return _weth The wrapped native token, or the zero address on a chain with no wrapped-native token, where\n   *         `WRAP_ETH` and `UNWRAP_WETH` are disabled.\n   */\n  function WETH() external view returns (IWETH _weth);\n\n  /**\n   * @notice Leaf Voter used to validate gauge targets and resolve their reward contracts.\n   * @dev The zero address on a lite deployment with no voting system, where the gauge staking and claim commands\n   *      revert with `CommandDisabled`.\n   * @return _leafVoter The leaf Voter.\n   */\n  function LEAF_VOTER() external view returns (ILeafVoter _leafVoter);\n\n  /**\n   * @notice Token delivered to recipients by a gauge-emissions claim on this chain: the `ReceiptToken` on leaf\n   *         deployments, or the canonical `TOKEN` on root, where the receipt is redeemed for `TOKEN` in the same\n   *         transaction.\n   * @return _emissionToken The gauge-emissions token this router custodies and sweeps.\n   */\n  function EMISSION_TOKEN() external view returns (IERC20 _emissionToken);\n\n  /**\n   * @notice Interchain account router used by the cross-chain commands to derive accounts and dispatch commitments.\n   * @dev The zero address on a lite deployment with no cross-chain layer, where every command that derives an\n   *      interchain account reverts with `CommandDisabled`. A `BRIDGE_TOKEN` naming a direct recipient never reads\n   *      this router, so it stays available there.\n   * @return _icaRouter The interchain account router.\n   */\n  function ICA_ROUTER() external view returns (IInterchainAccountRouter _icaRouter);\n\n  /**\n   * @notice Registry used to authenticate pools, target factories, and gauge-to-factory relationships.\n   * @return _factoryRegistry Factory registry used by venue-sensitive commands.\n   */\n  function FACTORY_REGISTRY() external view returns (IFactoryRegistry _factoryRegistry);\n\n  /**\n   * @notice ERC20 entry point of the chain's native asset, on chains where one exists; the zero address elsewhere.\n   * @dev The token's balance is the account's native balance expressed in the token's own decimals, so spend\n   *      resolution caps it at the batch's own native converted through `NATIVE_ERC20_SCALE`: spending the full\n   *      balance would drain the pre-batch native the batch must preserve and revert the closure.\n   *      The closing sweep skips its entry point entirely and returns the batch's portion through the native refund,\n   *      since some implementations reject a zero-value `transfer`; a recipient that rejects that refund is paid\n   *      through this entry point instead. On implementations that reject value-less transfers the ERC20-style\n   *      commands on this token revert mid-batch too; that is the token's own behavior, not the router's.\n   *      Never transfer or pre-fund this token ahead of `execute`: provide it as `msg.value` or pull it through\n   *      `FUND_ERC20` during the active batch. Value the router already holds when a batch opens counts as pre-batch\n   *      native, is excluded from batch custody, and cannot be recovered.\n   * @return _nativeErc20 The native ERC20, or the zero address when the chain has none.\n   */\n  function NATIVE_ERC20() external view returns (IERC20 _nativeErc20);\n\n  /**\n   * @notice Native value represented by one raw unit of the native ERC20, derived from the token's decimals.\n   * @dev Some chains express the same native asset in different precisions per interface: eighteen decimals for\n   *      `address.balance` and `msg.value`, the token's own decimals for `balanceOf` and `transfer`. Every place\n   *      that mixes the two representations converts through this factor: the batch's spendable native — less any\n   *      committed message fee — converts to the native ERC20 decimals rounding down, so a full spend can never reach the\n   *      pre-batch native; a native refund paid through the native ERC20 also floors, leaving dust the token cannot\n   *      express. One on an eighteen-decimal native ERC20, where both interfaces share raw values.\n   * @return _nativeErc20Scale Native value per raw native ERC20 unit, or zero when the chain has no native ERC20.\n   */\n  function NATIVE_ERC20_SCALE() external view returns (uint256 _nativeErc20Scale);\n\n  /**\n   * @notice Whether this deployment is the root chain, where `VotingEscrow` and the Relay exist.\n   * @dev Gates the root-only `CREATE_STAKE` and `DEPOSIT_RELAY` commands; derived at construction from whether the\n   *      local chain id equals the orchestrator's `ROOT_CHAIN_ID`.\n   * @return _isRoot True on the root deployment, false on a leaf.\n   */\n  function IS_ROOT() external view returns (bool _isRoot);\n\n  /**\n   * @notice VotingEscrow that `CREATE_STAKE` and `DEPOSIT_RELAY` act on, resolved from the root Voter's\n   *         `VOTING_ESCROW()`; the zero address on a leaf deployment.\n   * @return _stakingEscrow The VotingEscrow, or the zero address on a leaf.\n   */\n  function STAKING_ESCROW() external view returns (IVotingEscrow _stakingEscrow);\n\n  /**\n   * @notice Token `CREATE_STAKE` stakes into a new sAERO, resolved from `STAKING_ESCROW.TOKEN()`; zero on a leaf.\n   * @return _stakingToken The staking token, or the zero address on a leaf.\n   */\n  function STAKING_TOKEN() external view returns (IERC20 _stakingToken);\n\n  /**\n   * @notice RelayFactoryRegistry that `DEPOSIT_RELAY` authenticates a caller-selected relay's factory against; the\n   *         zero address on a leaf deployment, where the command is gated off.\n   * @return _relayFactoryRegistry The RelayFactoryRegistry, or the zero address on a leaf.\n   */\n  function RELAY_FACTORY_REGISTRY() external view returns (IRelayFactoryRegistry _relayFactoryRegistry);\n}\n"},"V3/src/interfaces/pools/ICLPool.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title ICLPool\n * @notice Concentrated-liquidity pool surface required by Metarouter swaps.\n */\ninterface ICLPool {\n  /**\n   * @notice Executes an exact-input swap for positive `_amountSpecified` or an exact-output swap for a negative one.\n   * @param _recipient Address receiving the output token.\n   * @param _zeroForOne Whether token0 is exchanged for token1.\n   * @param _amountSpecified Exact input amount or negated exact output amount.\n   * @param _sqrtPriceLimitX96 Terminal square-root-price boundary.\n   * @param _data Data forwarded to `uniswapV3SwapCallback`.\n   * @return _amount0 Signed token0 balance change of the pool.\n   * @return _amount1 Signed token1 balance change of the pool.\n   */\n  function swap(\n    address _recipient,\n    bool _zeroForOne,\n    int256 _amountSpecified,\n    uint160 _sqrtPriceLimitX96,\n    bytes calldata _data\n  ) external returns (int256 _amount0, int256 _amount1);\n\n  /**\n   * @notice Returns the pool type identifier used to validate Metarouter routes.\n   * @return _poolType Canonical CL pool type label.\n   */\n  function POOL_TYPE() external view returns (bytes32 _poolType);\n\n  /**\n   * @notice Factory that deployed the pool.\n   * @return _factory Pool factory address.\n   */\n  function factory() external view returns (address _factory);\n\n  /**\n   * @notice Pool token sorted first by address.\n   * @return _token0 First pool token.\n   */\n  function token0() external view returns (address _token0);\n\n  /**\n   * @notice Pool token sorted second by address.\n   * @return _token1 Second pool token.\n   */\n  function token1() external view returns (address _token1);\n}\n"},"V3/src/interfaces/pools/IPool.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IPool\n * @notice Interface for the Pool contract, the abstract base shared by the Aerodrome V2 volatile and stable pools\n */\ninterface IPool {\n  /*////////////////////////////////////////////////////////////\n                            EVENTS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Emitted when fees are claimed by a liquidity provider\n  /// @param sender Address that triggered the fee claim\n  /// @param amount0 Amount of token0 fees collected\n  /// @param amount1 Amount of token1 fees collected\n  event Fees(address indexed sender, uint256 amount0, uint256 amount1);\n  /// @notice Emitted when liquidity is minted\n  /// @param sender Address that initiated the mint\n  /// @param to Address that received the LP tokens\n  /// @param amount0 Amount of token0 deposited\n  /// @param amount1 Amount of token1 deposited\n  event Mint(address indexed sender, address indexed to, uint256 amount0, uint256 amount1);\n  /// @notice Emitted when liquidity is burned\n  /// @param sender Address that initiated the burn\n  /// @param to Address that received the underlying tokens\n  /// @param amount0 Amount of token0 returned\n  /// @param amount1 Amount of token1 returned\n  event Burn(address indexed sender, address indexed to, uint256 amount0, uint256 amount1);\n  /// @notice Emitted on every swap executed through the pool\n  /// @param sender Address that initiated the swap\n  /// @param to Address that received the output tokens\n  /// @param amount0In Amount of token0 provided as input\n  /// @param amount1In Amount of token1 provided as input\n  /// @param amount0Out Amount of token0 sent as output\n  /// @param amount1Out Amount of token1 sent as output\n  event Swap(\n    address indexed sender,\n    address indexed to,\n    uint256 amount0In,\n    uint256 amount1In,\n    uint256 amount0Out,\n    uint256 amount1Out\n  );\n  /// @notice Emitted when reserves are synced to the current balances\n  /// @param reserve0 Updated reserve of token0\n  /// @param reserve1 Updated reserve of token1\n  event Sync(uint256 reserve0, uint256 reserve1);\n\n  /// @notice Emitted when accumulated fee tokens are claimed\n  /// @param caller Address that triggered the claim\n  /// @param account Address whose accumulated fees were claimed\n  /// @param recipient Address that received the fee tokens\n  /// @param amount0 Amount of token0 claimed\n  /// @param amount1 Amount of token1 claimed\n  event Claim(\n    address indexed caller, address indexed account, address indexed recipient, uint256 amount0, uint256 amount1\n  );\n  /// @notice Emitted when an account grants or revokes claim approval for an operator\n  /// @param account Account whose approval state changed\n  /// @param operator Operator being approved or revoked\n  /// @param approved New approval state\n  event ClaimApproval(address indexed account, address indexed operator, bool approved);\n  /// @notice Emitted whenever `observationCardinalityNext` is increased\n  /// @param caller Address that triggered the cardinality growth\n  /// @param observationCardinalityNextOld Previous value of `observationCardinalityNext`\n  /// @param observationCardinalityNextNew New value of `observationCardinalityNext`\n  event IncreaseObservationCardinalityNext(\n    address indexed caller, uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew\n  );\n\n  /*////////////////////////////////////////////////////////////\n                            ERRORS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when the factory address has already been set and cannot be changed\n  error FactoryAlreadySet();\n  /// @notice Thrown when the input amount provided to a swap is zero or insufficient\n  error InsufficientInputAmount();\n  /// @notice Thrown when the pool does not have enough liquidity to fulfil the operation\n  error InsufficientLiquidity();\n  /// @notice Thrown when burning LP tokens would return zero of at least one underlying token\n  error InsufficientLiquidityBurned();\n  /// @notice Thrown when minting would produce zero LP tokens\n  error InsufficientLiquidityMinted();\n  /// @notice Thrown when the output amount of a swap is zero or below the requested minimum\n  error InsufficientOutputAmount();\n  /// @notice Thrown when the `to` address supplied to swap or burn is one of the pool's tokens\n  error InvalidTo();\n  /// @notice Thrown when an operation is attempted while the pool is paused\n  error IsPaused();\n  /// @notice Thrown when the invariant K check fails after a swap\n  error K();\n  /// @notice Thrown when the caller is neither the account nor an approved claim operator\n  error NotAuthorized();\n  /// @notice Thrown when a zero address is supplied where a non-zero address is required\n  error ZeroAddress();\n  /*////////////////////////////////////////////////////////////\n                        EXTERNAL FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Grants or revokes an operator's permission to claim the caller's accumulated fees\n  /// @param _operator Operator whose approval is updated\n  /// @param _approved Whether the operator is approved\n  function approveForClaim(address _operator, bool _approved) external;\n\n  /// @notice Claims the caller's accumulated fees\n  /// @param _recipient Address that receives the claimed fee tokens\n  /// @return _amount0 Amount of token0 claimed\n  /// @return _amount1 Amount of token1 claimed\n  function claimFees(address _recipient) external returns (uint256 _amount0, uint256 _amount1);\n\n  /// @notice Claims an account's accumulated fees\n  /// @dev The caller must be `_account` or an operator approved by `_account`\n  /// @param _account Account whose accumulated fees are claimed\n  /// @param _recipient Address that receives the claimed fee tokens\n  /// @return _amount0 Amount of token0 claimed\n  /// @return _amount1 Amount of token1 claimed\n  function claimFees(address _account, address _recipient) external returns (uint256 _amount0, uint256 _amount1);\n\n  /// @notice Returns the value of K in the Pool, based on its reserves.\n  function getK() external returns (uint256);\n\n  /// @notice Set pool name\n  ///         Only callable by IPoolFactory(factory).poolAdmin()\n  /// @param __name String of new name\n  function setName(string calldata __name) external;\n\n  /// @notice Set pool symbol\n  ///         Only callable by IPoolFactory(factory).poolAdmin()\n  /// @param __symbol String of new symbol\n  function setSymbol(string calldata __symbol) external;\n\n  /// @notice This low-level function should be called from a contract which performs important safety checks\n  /// @param amount0Out Amount of token0 to send to `to`\n  /// @param amount1Out Amount of token1 to send to `to`\n  /// @param to Address to recieve the swapped output\n  /// @param data Additional calldata for flashloans\n  function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n\n  /// @notice This low-level function should be called from a contract which performs important safety checks\n  ///         standard uniswap v2 implementation\n  /// @param to Address to receive token0 and token1 from burning the pool token\n  /// @return amount0 Amount of token0 returned\n  /// @return amount1 Amount of token1 returned\n  function burn(address to) external returns (uint256 amount0, uint256 amount1);\n\n  /// @notice This low-level function should be called by addLiquidity functions in Router.sol, which performs important safety checks\n  ///         standard uniswap v2 implementation\n  /// @param to Address to receive the minted LP token\n  /// @return liquidity Amount of LP token minted\n  function mint(address to) external returns (uint256 liquidity);\n\n  /// @notice Force balances to match reserves\n  /// @param to Address to receive any skimmed rewards\n  function skim(address to) external;\n\n  /// @notice Force reserves to match balances\n  function sync() external;\n\n  /// @notice Called on pool creation by the owning PoolFactory\n  /// @param _token0 Address of token0\n  /// @param _token1 Address of token1\n  function initialize(address _token0, address _token1) external;\n\n  /// @notice Pre-allocates buffer slots increasing the buffer capacity\n  /// @param _observationCardinalityNext New target capacity. At most 65,535.\n  function increaseObservationCardinalityNext(uint16 _observationCardinalityNext) external;\n\n  /*////////////////////////////////////////////////////////////\n                      PURE AND VIEW FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Returns the decimal (dec), reserves (r), and tokens (t) of token0 and token1\n  function metadata() external view returns (uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, address t0, address t1);\n\n  /// @notice Returns [token0, token1]\n  function tokens() external view returns (address, address);\n\n  /// @notice Returns accumulated but unclaimed fees for an account.\n  /// @param _account Address to query.\n  /// @return _amount0 Pending token0 fees.\n  /// @return _amount1 Pending token1 fees.\n  function pendingFees(address _account) external view returns (uint256 _amount0, uint256 _amount1);\n\n  /// @notice Address of token in the pool with the lower address value\n  function token0() external view returns (address);\n\n  /// @notice Address of token in the pool with the higher address value\n  function token1() external view returns (address);\n\n  /// @notice Address of linked PoolFees.sol\n  function poolFees() external view returns (address);\n\n  /// @notice Address of PoolFactory that created this contract\n  function factory() external view returns (address);\n\n  /// @notice Period gate for new observations, in seconds. A new observation is written when more\n  ///         than `PERIOD_SIZE` seconds have passed since the last one, so the smallest possible\n  ///         spacing between two stored observations is `PERIOD_SIZE + 1` (i.e. 61 seconds at the\n  ///         default value of 60).\n  function PERIOD_SIZE() external view returns (uint256);\n\n  /// @notice The pool type identifier\n  /// @return The pool type label to be able to identify the type of pool\n  function POOL_TYPE() external view returns (bytes32);\n\n  /// @notice Amount of token0 in pool\n  function reserve0() external view returns (uint256);\n\n  /// @notice Amount of token1 in pool\n  function reserve1() external view returns (uint256);\n\n  /// @notice Timestamp of last update to pool\n  function blockTimestampLast() external view returns (uint256);\n\n  /// @notice Cumulative of reserve0 factoring in time elapsed\n  function reserve0CumulativeLast() external view returns (uint256);\n\n  /// @notice Cumulative of reserve1 factoring in time elapsed\n  function reserve1CumulativeLast() external view returns (uint256);\n\n  /// @notice Accumulated fees of token0 (global)\n  function index0() external view returns (uint256);\n\n  /// @notice Accumulated fees of token1 (global)\n  function index1() external view returns (uint256);\n\n  /// @notice Get an LP's relative index0 to index0\n  function supplyIndex0(address) external view returns (uint256);\n\n  /// @notice Get an LP's relative index1 to index1\n  function supplyIndex1(address) external view returns (uint256);\n\n  /// @notice Amount of unclaimed, but claimable tokens from fees of token0 for an LP\n  function claimable0(address) external view returns (uint256);\n\n  /// @notice Amount of unclaimed, but claimable tokens from fees of token1 for an LP\n  function claimable1(address) external view returns (uint256);\n\n  /// @notice Whether an operator may claim an account's accumulated fees\n  /// @param _account Account that owns the accumulated fees\n  /// @param _operator Operator whose approval is queried\n  /// @return _approved Whether the operator is approved\n  function approvedForClaim(address _account, address _operator) external view returns (bool _approved);\n\n  /// @notice Produces the cumulative price using counterfactuals to save gas and avoid a call to sync.\n  function currentCumulativePrices()\n    external\n    view\n    returns (uint256 reserve0Cumulative, uint256 reserve1Cumulative, uint256 blockTimestamp);\n\n  /// @notice Update reserves and, on the first call per block, price accumulators\n  /// @return _reserve0 .\n  /// @return _reserve1 .\n  /// @return _blockTimestampLast .\n  function getReserves() external view returns (uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast);\n\n  /// @notice Get the amount of tokenOut given the amount of tokenIn, charging only the base fee\n  /// @dev Does not charge the MEV tax, so the result can be higher than what `swap` pays out.\n  ///      Use `getAmountOutWithTotalFee` to quote a swap.\n  /// @param amountIn Amount of token in\n  /// @param tokenIn Address of token\n  /// @return Amount out\n  function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256);\n\n  /// @notice Get the amount of tokenOut given the amount of tokenIn, charging the total fees\n  /// @param amountIn Amount of token in\n  /// @param tokenIn Address of token in\n  /// @return Amount out\n  function getAmountOutWithTotalFee(uint256 amountIn, address tokenIn) external view returns (uint256);\n\n  /// @notice Get the amount of tokenIn required to receive the amount of tokenOut, charging the total fees\n  /// @dev Reverts if the exact output cannot be calculated\n  /// @param amountOut Amount of token out to receive\n  /// @param tokenOut Address of token out\n  /// @return Amount in, fee included\n  function getAmountInWithTotalFee(uint256 amountOut, address tokenOut) external view returns (uint256);\n\n  /// @notice Returns the cumulative reserves as of each requested `secondsAgo`. Reverts when any\n  ///         `secondsAgos[i]` predates the oldest stored observation.\n  /// @dev Offsets between two stored observations are linearly interpolated. Observations are\n  ///      period-gated, so reserve changes within an interval may go unrecorded, making the\n  ///      interpolation an approximation. Read from the pool directly when an exact value is required.\n  /// @dev A point newer than the newest stored observation is estimated from the current cumulative\n  ///      instead of two stored ones, so a trade after that point can change what it reads. It stops\n  ///      changing once an observation is stored at or after that point. Points that already fall\n  ///      between two stored observations read the same on every call.\n  /// @param secondsAgos Array of seconds offsets from `block.timestamp` to query\n  /// @return reserve0Cumulatives Cumulative reserve0 values at each requested point\n  /// @return reserve1Cumulatives Cumulative reserve1 values at each requested point\n  function observe(uint32[] calldata secondsAgos)\n    external\n    view\n    returns (uint256[] memory reserve0Cumulatives, uint256[] memory reserve1Cumulatives);\n\n  /// @notice Quote `amountIn` of `tokenIn` against a custom reserve snapshot\n  /// @dev Subtracts the base fee from `amountIn` before applying the curve. Does not charge the MEV\n  ///      tax, so use `getAmountOutWithTotalFee` to quote a swap.\n  /// @param amountIn Input amount in the smallest unit of `tokenIn`\n  /// @param tokenIn Address of the input token\n  /// @param _reserve0 Reserve of token0 to quote against\n  /// @param _reserve1 Reserve of token1 to quote against\n  /// @return Output amount the swap would produce against the supplied reserves\n  function getAmountOut(\n    uint256 amountIn,\n    address tokenIn,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256);\n\n  /// @notice TWAP circular buffer metadata\n  /// @return index Index of the most recent observation in the buffer\n  /// @return cardinality Number of populated slots in the buffer\n  /// @return cardinalityNext Number of slots that can be written\n  function observationBuffer() external view returns (uint16 index, uint16 cardinality, uint16 cardinalityNext);\n\n  /// @notice Returns the observation at the given index\n  /// @param index Index of the observation to return\n  /// @return timestamp Timestamp of the observation\n  /// @return reserve0Cumulative Cumulative reserve0 of the observation\n  /// @return reserve1Cumulative Cumulative reserve1 of the observation\n  function observations(uint256 index)\n    external\n    view\n    returns (uint32 timestamp, uint256 reserve0Cumulative, uint256 reserve1Cumulative);\n}\n"},"V3/src/interfaces/relay/IRelayFactoryRegistry.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IRelayFactoryRegistry\n * @notice Approval set of the relay factories the protocol trusts. A consumer handed a relay address\n *         resolves the relay's factory, checks it here, then asks that factory whether it created\n *         the relay. The set is governed by GOVERNANCE_ROLE on the root Voter, a seat above the\n *         relay deployer. It gates what a consumer accepts, not relay creation. The factory checks only\n *         RELAY_DEPLOYER_ROLE, and a relay keeps taking direct deposits whether or not its factory is in\n *         the set.\n */\ninterface IRelayFactoryRegistry {\n  /**\n   * @notice Emitted when a relay factory enters the approval set.\n   * @param _relayFactory The relay factory registered.\n   */\n  event RelayFactoryRegistered(address indexed _relayFactory);\n\n  /**\n   * @notice Emitted when a relay factory leaves the approval set.\n   * @param _relayFactory The relay factory unregistered.\n   */\n  event RelayFactoryUnregistered(address indexed _relayFactory);\n\n  /// @notice Thrown when the caller lacks GOVERNANCE_ROLE on the Voter.\n  error NotAuthorized();\n\n  /// @notice Thrown when a zero address is supplied where an address is required.\n  error ZeroAddress();\n\n  /// @notice Thrown when registering a relay factory already in the approval set.\n  error AlreadyRegistered();\n\n  /// @notice Thrown when unregistering a relay factory not in the approval set.\n  error NotRegistered();\n\n  /**\n   * @notice Add a relay factory to the approval set. Multiple relay factories can be approved at\n   *         once so relays of an older factory keep working while a new one rolls out.\n   * @dev Caller must hold GOVERNANCE_ROLE on the Voter. Reverts on the zero address and a relay\n   *      factory already in the set.\n   * @param _relayFactory The relay factory to register.\n   */\n  function registerRelayFactory(address _relayFactory) external;\n\n  /**\n   * @notice Remove a relay factory from the approval set. Every relay that factory created stops\n   *         passing the consumers' checks at once. Direct calls on those relays are untouched.\n   * @dev Caller must hold GOVERNANCE_ROLE on the Voter. Reverts when the relay factory is not\n   *      in the set.\n   * @param _relayFactory The relay factory to unregister.\n   */\n  function unregisterRelayFactory(address _relayFactory) external;\n\n  /**\n   * @notice True when the relay factory is in the approval set.\n   * @dev Membership alone does not authenticate a relay. A spoofed relay can report any factory, so\n   *      a consumer must also ask the approved factory whether it created the relay.\n   * @param _relayFactory The relay factory to check.\n   * @return _approved Whether the relay factory is registered.\n   */\n  function isRelayFactoryApproved(address _relayFactory) external view returns (bool _approved);\n\n  /**\n   * @notice The registered relay factories.\n   * @return _factories The relay factory approval set as an array.\n   */\n  function relayFactories() external view returns (address[] memory _factories);\n\n  /**\n   * @notice The number of registered relay factories.\n   * @return _length The size of the approval set.\n   */\n  function relayFactoriesLength() external view returns (uint256 _length);\n\n  /**\n   * @notice The relay factory at an index of the approval set.\n   * @param _index The index to read.\n   * @return _relayFactory The member at the index, zero for an out of range index.\n   */\n  function relayFactoriesAt(uint256 _index) external view returns (address _relayFactory);\n\n  /**\n   * @notice The Voter whose GOVERNANCE_ROLE governs the approval set.\n   * @return _voter The Voter address.\n   */\n  function VOTER() external view returns (address _voter);\n}\n"},"V3/src/interfaces/voter/ILeafVoter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol';\n\nimport {ILeafMessageOrchestrator} from 'V3/interfaces/bridge/ILeafMessageOrchestrator.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IReceiptTokenExtensions as IReceiptToken} from 'V3/interfaces/token/IReceiptTokenExtensions.sol';\nimport {IVoterCommon} from 'V3/interfaces/voter/IVoterCommon.sol';\n\n/**\n * @title ILeafVoter\n * @notice Leaf-chain Voter: turns per-chain reward rates and per-tokenId allocations into per-gauge emission\n *         rates, and exposes the claim surface for gauges and the redeem surface for `ReceiptToken` holders.\n * @dev Root drives two paths through the Leaf MessageOrchestrator: `applyChainAllocation` sets the chain budget\n *      and emissions scalar (no cooldown), `applyGaugeAllocations` spreads it over gauges (cooldown per chain).\n * @dev An operator drives local redistributions through `allocateGauges`. Settlement state advances lazily.\n */\ninterface ILeafVoter is IVoterCommon, IAccessControl {\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Operational roles and fee collection gas initialized with the voter.\n   * @dev Zero operational holders leave their role unassigned. A nonzero bootstrap admin holds only the\n   *      factory registry and module admin roles while later deployment units register their components.\n   * @param voterConfigurer Initial voter configuration role holder.\n   * @param tokenWhitelister Initial token whitelist role holder.\n   * @param chainStatusAuthority Initial chain status role holder.\n   * @param factoryRegistryAdmin Initial factory registry admin role holder.\n   * @param moduleAdmin Initial module admin role holder.\n   * @param gasConfigurer Initial gas configuration role holder.\n   * @param nativeWithdrawer Initial native withdrawal role holder.\n   * @param bootstrapAdmin Temporary factory registry and module admin role holder, or zero.\n   * @param collectFeesGasLimit Gas forwarded when a rewards manager collects gauge fees.\n   */\n  struct InitialConfiguration {\n    address voterConfigurer;\n    address tokenWhitelister;\n    address chainStatusAuthority;\n    address factoryRegistryAdmin;\n    address moduleAdmin;\n    address gasConfigurer;\n    address nativeWithdrawer;\n    address bootstrapAdmin;\n    uint256 collectFeesGasLimit;\n  }\n\n  /**\n   * @notice Dependencies, authorities and static configuration seeded during voter deployment.\n   * @param governor Initial governance role holder.\n   * @param configAdmin Initial configuration admin role holder.\n   * @param leafMessageOrchestrator Local messaging orchestrator.\n   * @param receiptToken Receipt token burned when emissions are redeemed.\n   * @param factoryRegistry Registry resolving gauge factories and rewards.\n   * @param gaugeManager Manager authorized to register and activate gauges.\n   * @param allocationCooldown Minimum duration between local allocations.\n   * @param minIncentiveDuration Minimum duration for incentive programs.\n   * @param maxGauges Maximum gauges in a local allocation.\n   * @param adapterAuthority Initial transport configuration role holder.\n   * @param emissionsHandler Handler delivering minted emissions.\n   * @param emergencyCouncil Initial emergency authority.\n   * @param initialConfiguration Operational holders, registration bootstrap admin and fee collection gas.\n   */\n  struct ConstructorParams {\n    address governor;\n    address configAdmin;\n    address leafMessageOrchestrator;\n    address receiptToken;\n    address factoryRegistry;\n    address gaugeManager;\n    uint48 allocationCooldown;\n    uint48 minIncentiveDuration;\n    uint256 maxGauges;\n    address adapterAuthority;\n    address emissionsHandler;\n    address emergencyCouncil;\n    InitialConfiguration initialConfiguration;\n  }\n\n  /**\n   * @notice Per-gauge settlement state, kept in one mapping so `_settleGauge` touches contiguous slots.\n   * @param ceiling Cumulative effective share credited to the gauge; only ever increases.\n   * @param claimed Cumulative emissions minted by claims; only ever increases, capped at `ceiling - surplus`.\n   * @param lastSettlement Timestamp of this gauge's last settlement.\n   * @param isRegistered Produced by an approved factory; gates routing and makes `settleGauge` a no-op if unset.\n   * @param isActivated Registered gauges start inactive and route as unregistered until this flips.\n   * @param surplus Cumulative forfeited surplus, clamped per report; `ceiling >= claimed + surplus` always holds.\n   * @param lastIndex Chain `index` at this gauge's last settlement.\n   * @param lastTimeIndex Chain `timeIndex` at this gauge's last settlement.\n   * @param point Decaying weight, resolved through `gaugeSlopeChanges` during settlement.\n   */\n  struct GaugeState {\n    uint128 ceiling;\n    uint128 claimed;\n    uint48 lastSettlement;\n    bool isRegistered;\n    bool isActivated;\n    uint128 surplus;\n    uint256 lastIndex;\n    uint256 lastTimeIndex;\n    Point point;\n  }\n\n  /**\n   * @notice Packed per-tokenId allocation state; the gating fields share one slot.\n   * @param operator Address authorized to run the local `allocateGauges` for this tokenId.\n   * @param lastAllocated Timestamp of the last allocation; the cooldown counts from here.\n   * @param canVoteForZeroCapGauges Whether the tokenId may route weight onto activated gauges whose emission\n   *                                cap is zero.\n   * @param chainAllocation Chain budget the tokenId may distribute, from its last root allocation.\n   */\n  struct TokenState {\n    address operator;\n    uint48 lastAllocated;\n    bool canVoteForZeroCapGauges;\n    uint128 chainAllocation;\n  }\n\n  /**\n   * @notice Per-gauge checkpoint entry returned by `_processAllocation` to drive the reward checkpoint.\n   * @dev Self-contained: checkpoints are external calls in a loop, so storage is not re-read between them.\n   * @dev `ZERO_GAUGE` never appears in the array.\n   * @param gauge Gauge this entry checkpoints.\n   * @param allocated Allocation checkpointed against, captured at record time so reentrancy cannot change it.\n   * @param data Opaque payload for the reward checkpoint; empty when the entry only clears a position (zero).\n   */\n  struct CheckpointData {\n    address gauge;\n    uint128 allocated;\n    bytes data;\n  }\n\n  /**\n   * @notice Fee claim request forwarded through the LeafVoter.\n   * @param votingRewardsManager VotingRewardsManager to claim fees from.\n   * @param maxCheckpoints Maximum number of user checkpoints to process.\n   */\n  struct FeeClaim {\n    address votingRewardsManager;\n    uint256 maxCheckpoints;\n  }\n\n  /**\n   * @notice Incentive claim request forwarded through the LeafVoter.\n   * @param votingRewardsManager VotingRewardsManager to claim incentives from.\n   * @param programId Incentive program ID to claim from.\n   * @param maxCheckpoints Maximum number of user checkpoints to process.\n   */\n  struct IncentiveClaim {\n    address votingRewardsManager;\n    uint256 programId;\n    uint256 maxCheckpoints;\n  }\n\n  /**\n   * @notice Mutable context threaded by memory reference through one `_processAllocation` pass.\n   * @param tokenId The tokenId being processed.\n   * @param oldSnapshot Token state at entry; unwinds resolve against its `stakeEnd`.\n   * @param newSnapshot Incoming token state; applies resolve against its `stakeEnd`.\n   * @param expired True when the new stake already expired at `lastSettlement`; skips the apply side.\n   * @param canVoteForZeroCapGauges Read once from the token state; lets `_processGauge` skip the emission cap\n   *                                gate instead of redirecting the weight to `ZERO_GAUGE`.\n   * @param list Result entries, sized to the union upper bound and trimmed at return.\n   * @param entryCount Number of entries written to `list` so far.\n   * @param bookedAmount Weight actually booked on real gauges; everything else parks on `ZERO_GAUGE`.\n   * @param deallocAmount Weight routed to `DEALLOC_GAUGE`, returned to root after the pass; never persisted.\n   */\n  struct AllocationContext {\n    uint256 tokenId;\n    TokenSnapshot oldSnapshot;\n    TokenSnapshot newSnapshot;\n    bool expired;\n    bool canVoteForZeroCapGauges;\n    CheckpointData[] list;\n    uint256 entryCount;\n    uint128 bookedAmount;\n    uint128 deallocAmount;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Emitted when the gas limit used to flush gauge fees is set.\n   * @param _gasLimit New gas limit shared by this chain's reward managers.\n   */\n  event CollectFeesGasLimitSet(uint256 _gasLimit);\n\n  /**\n   * @notice Emitted when a gauge completes a claim through `mintEmissions`.\n   * @param _gauge Gauge that invoked `mintEmissions`.\n   * @param _recipients Recipients passed by the gauge, typically the LP and the referral leg.\n   * @param _amounts Per-leg amounts of `ReceiptToken` allocated to each recipient.\n   */\n  event EmissionsMinted(address indexed _gauge, address[] _recipients, uint128[] _amounts);\n\n  /**\n   * @notice Emitted when `ReceiptToken` is redeemed and the `Redeem` message is dispatched to root.\n   * @param _redeemer Address whose `ReceiptToken` was burned.\n   * @param _recipient Address that receives the minted `TOKEN` on root.\n   * @param _amount Amount burned, equal to the `TOKEN` to mint on root.\n   */\n  event Redeemed(address indexed _redeemer, address indexed _recipient, uint256 _amount);\n\n  /**\n   * @notice Emitted when a fee claim targets an unregistered VotingRewardsManager and the LeafVoter continues.\n   * @param _tokenId The veNFT token ID whose fee claim failed.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the failed fee claim.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the failed fee claim.\n   */\n  event FeeClaimFailed(uint256 indexed _tokenId, address indexed _votingRewardsManager, uint256 _maxCheckpoints);\n\n  /**\n   * @notice Emitted when a forwarded fee claim completes without reverting.\n   * @param _tokenId The veNFT token ID whose fee claim succeeded.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the successful fee claim.\n   * @param _recipient Address that received any claimed fees.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the fee claim.\n   */\n  event FeeClaimSucceeded(\n    uint256 indexed _tokenId, address indexed _votingRewardsManager, address indexed _recipient, uint256 _maxCheckpoints\n  );\n\n  /**\n   * @notice Emitted when an incentive claim targets an unregistered VotingRewardsManager and the LeafVoter continues.\n   * @param _tokenId The veNFT token ID whose incentive claim failed.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the failed incentive claim.\n   * @param _programId Incentive program ID whose claim failed.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the failed incentive claim.\n   */\n  event IncentiveClaimFailed(\n    uint256 indexed _tokenId, address indexed _votingRewardsManager, uint256 indexed _programId, uint256 _maxCheckpoints\n  );\n\n  /**\n   * @notice Emitted when a forwarded incentive claim completes without reverting.\n   * @param _tokenId The veNFT token ID whose incentive claim succeeded.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the successful incentive claim.\n   * @param _programId Incentive program ID whose claim succeeded.\n   * @param _recipient Address that received any claimed incentives.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the incentive claim.\n   */\n  event IncentiveClaimSucceeded(\n    uint256 indexed _tokenId,\n    address indexed _votingRewardsManager,\n    uint256 indexed _programId,\n    address _recipient,\n    uint256 _maxCheckpoints\n  );\n\n  /**\n   * @notice Emitted when a token's parked `DEALLOC_GAUGE` balance is drained and sent back to root.\n   * @param _tokenId veNFT id whose parked voting power was deallocated.\n   * @param _amount Voting power returned to root's `CHAIN0`.\n   */\n  event Deallocated(uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when an `EmergencyDeallocate` message re-syncs a token's position with root.\n   * @param _tokenId veNFT id whose position on the chain was reduced.\n   */\n  event EmergencyDeallocationApplied(uint256 indexed _tokenId);\n\n  /**\n   * @notice Emitted when a gauge's settlement cursor advances.\n   * @dev Shares cover the entire settled interval, summed across its weekly segments. Already settled gauges\n   *      emit nothing. `ZERO_GAUGE` has a zero cap and credits its entire allocated share to surplus.\n   * @param _gauge Gauge whose accrued emissions were settled.\n   * @param _effectiveShare Emissions credited to the gauge during this settlement, in raw TOKEN units.\n   * @param _surplusDelta Cap excess added to the chain surplus during this settlement, in raw TOKEN units.\n   * @param _cap Resolved per-second emission cap used throughout the settlement, in raw TOKEN units.\n   * @param _gaugeWeight Voting power at the settlement timestamp after any defensive clamp, before allocation changes.\n   */\n  event GaugeCapSettled(\n    address indexed _gauge, uint128 _effectiveShare, uint128 _surplusDelta, uint128 _cap, uint256 _gaugeWeight\n  );\n\n  /**\n   * @notice Emitted when `_walkGauge` clamps a sub-zero resolved weight; signals an ordering or arithmetic bug.\n   * @param _gauge The gauge whose resolved weight underflowed.\n   * @param _detectedWeight The negative resolved weight seen before clamping.\n   */\n  event GaugeWeightClamped(address indexed _gauge, int256 _detectedWeight);\n\n  /**\n   * @notice Emitted when a registered gauge forfeits surplus emissions it cannot distribute.\n   * @param _gauge The gauge that forfeited the surplus.\n   * @param _amount Surplus accrued after clamping, which may be less than the reported amount.\n   */\n  event EmissionsForfeited(address indexed _gauge, uint128 _amount);\n\n  /**\n   * @notice Emitted when the leaf message orchestrator updates a tokenId's operator.\n   * @param _tokenId The tokenId whose operator was updated.\n   * @param _operator The new operator address.\n   */\n  event OperatorSet(uint256 indexed _tokenId, address indexed _operator);\n\n  /**\n   * @notice Emitted when a `ReduceCooldown` message accrues a tokenId's cooldown reduction.\n   * @param _tokenId The tokenId whose accumulated cooldown reduction increased.\n   * @param _reduction Seconds added by this message.\n   * @param _accumulated New total in seconds, clamped at `maxAccumulatedCooldownReduction`.\n   */\n  event CooldownReductionApplied(uint256 indexed _tokenId, uint48 _reduction, uint48 _accumulated);\n\n  /**\n   * @notice Emitted when a tokenId's can-vote-for-zero-cap-gauges flag is updated.\n   * @param _tokenId The tokenId whose flag was updated.\n   * @param _allowed The new flag value.\n   */\n  event CanVoteForZeroCapGaugesSet(uint256 indexed _tokenId, bool _allowed);\n\n  /**\n   * @notice Emitted when the local-voting master switch is set.\n   * @param _enabled True once local `allocateGauges` is open.\n   */\n  event LocalVotingEnabledSet(bool _enabled);\n\n  /**\n   * @notice Emitted when the local allocation cooldown is updated.\n   * @param _allocationCooldown The new cooldown duration in seconds.\n   */\n  event AllocationCooldownSet(uint48 _allocationCooldown);\n\n  /**\n   * @notice Emitted when the per-chain gauge-count cap is updated.\n   * @param _maxGauges The new cap on gauges a tokenId may allocate to locally.\n   */\n  event MaxGaugesSet(uint256 _maxGauges);\n\n  /**\n   * @notice Emitted when the cap on a tokenId's accumulated cooldown reduction is updated.\n   * @param _maxAccumulatedCooldownReduction New accumulation cap, in seconds.\n   */\n  event MaxAccumulatedCooldownReductionSet(uint48 _maxAccumulatedCooldownReduction);\n\n  /**\n   * @notice Emitted when the minimum incentive duration is updated.\n   * @param _minIncentiveDuration The new minimum duration in seconds.\n   */\n  event MinIncentiveDurationSet(uint48 _minIncentiveDuration);\n\n  /**\n   * @notice Emitted when the chain's operational status is updated.\n   * @param _status The new chain status.\n   */\n  event ChainStatusSet(ChainStatus _status);\n\n  /**\n   * @notice Emitted when a chain-allocation message is applied for a tokenId.\n   * @param _tokenId The tokenId whose chain budget was updated.\n   * @param _allocationDelta Additive delta this message applied (may be zero on a resync).\n   * @param _chainAllocation The resulting chain budget.\n   * @param _emissionsPerVP Stored scalar after the call, `PRECISION`-scaled; zero while `Suspended`.\n   */\n  event ChainAllocated(\n    uint256 indexed _tokenId, uint128 _allocationDelta, uint128 _chainAllocation, uint256 _emissionsPerVP\n  );\n\n  /**\n   * @notice Emitted when a tokenId's gauge distribution is applied, locally or bridged.\n   * @param _tokenId The tokenId whose gauges were allocated.\n   * @param _allocations Requested allocation; unroutable gauges may be redirected, so booked weight can differ.\n   * @param _emissionsPerVP Stored scalar after the call, `PRECISION`-scaled; zero while `Suspended`.\n   */\n  event GaugesAllocated(uint256 indexed _tokenId, GaugeAllocation[] _allocations, uint256 _emissionsPerVP);\n\n  /**\n   * @notice Emitted when a gauge is registered, active or not.\n   * @param gauge The registered gauge.\n   * @param activated Whether the gauge activated at registration.\n   * @param registrationCursor The chain `lastSettlement` the gauge's\n   *                           settlement cursor was seeded from.\n   */\n  event GaugeRegistered(address indexed gauge, bool activated, uint48 registrationCursor);\n\n  /**\n   * @notice Emitted when a gauge is activated, either at registration or\n   *         through delayed activation.\n   * @param gauge The activated gauge.\n   * @param activationCursor The effective activation cursor, the chain\n   *                         `lastSettlement` the gauge was anchored to.\n   */\n  event GaugeActivated(address indexed gauge, uint48 activationCursor);\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when a gas limit setter receives zero.\n  error ZeroGasLimit();\n\n  /// @notice Thrown when the caller is neither the veNFT's registered operator nor the Leaf MessageOrchestrator.\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a cross-chain entrypoint is called by anything but the Leaf MessageOrchestrator.\n   */\n  error NotMessageOrchestrator();\n\n  /**\n   * @notice Thrown when the local `allocateGauges` is called by anything but the tokenId's operator.\n   */\n  error NotOperator();\n\n  /**\n   * @notice Thrown when a gauge allocation runs before the per-chain cooldown has elapsed.\n   * @dev Gates on `allocationCooldown` minus the token's accumulated reduction, consumed on a passing call.\n   */\n  error CooldownActive();\n\n  /**\n   * @notice Thrown when the minimum incentive duration is set to zero.\n   */\n  error ZeroDuration();\n\n  /**\n   * @notice Thrown by `applyGaugeAllocations` past the root-stamped `expiry`; root must re-dispatch.\n   */\n  error AllocationExpired();\n\n  /**\n   * @notice Thrown when a gauge-lifecycle entrypoint is called by an address other than the GaugeManager.\n   */\n  error NotGaugeManager();\n\n  /**\n   * @notice Thrown by `registerGauge` when the gauge is already registered.\n   */\n  error GaugeAlreadyRegistered();\n\n  /**\n   * @notice Thrown by `activateGauge` when the gauge is already activated.\n   */\n  error GaugeAlreadyActivated();\n\n  /**\n   * @notice Thrown by `allocateGauges` while local voting is disabled, which is the default.\n   */\n  error LocalVotingDisabled();\n\n  /**\n   * @notice Thrown when a local `allocateGauges` runs before any chain allocation seeded the stake shape.\n   * @dev Defense in depth: `applyChainAllocation` seeds the shape first, so this should be unreachable. It\n   *      stops a distribution against the default permanent shape if that ordering ever breaks.\n   */\n  error StakeSnapshotMissing();\n\n  /**\n   * @notice Thrown when the allocated amounts do not exactly equal the tokenId's `chainAllocation`.\n   * @dev Counts the `DEALLOC_GAUGE` sentinel and the explicit `ZERO_GAUGE` idle entry; there is no backfill.\n   */\n  error ChainAllocationMismatch();\n\n  /**\n   * @notice Thrown when a local allocation targets more gauges than `maxGauges`.\n   * @dev The cap keeps a tokenId's gauge set within the bound root's reduction-message gas budgeting assumes.\n   */\n  error ExceedsMaxGauges();\n\n  /**\n   * @notice Thrown by `activateGauge` for an unregistered gauge, and by `forfeitEmissions` for a non-gauge caller.\n   */\n  error GaugeNotRegistered();\n\n  /**\n   * @notice Thrown when `mintEmissions` is invoked with `_recipients.length != _amounts.length`.\n   */\n  error ArrayLengthMismatch();\n\n  /**\n   * @notice Thrown when the redeem amount is smaller than `MIN_REDEEM_AMOUNT`.\n   */\n  error AmountTooLow();\n\n  /**\n   * @notice Thrown when `mintEmissions` claims more than `ceiling - claimed - surplus`.\n   */\n  error CeilingExceeded();\n\n  /**\n   * @notice Thrown when `mintEmissions`, `redeem` or `allocateGauges` is called while the chain status is\n   *         neither `Active` nor `Sunset`.\n   */\n  error ChainNotActiveOrSunset();\n\n  /*//////////////////////////////////////////////////////////////\n                                EXTERNAL\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Sets gas forwarded by reward managers when flushing gauge fees.\n   * @dev Requires GAS_CONFIGURER_ROLE. Must be nonzero; applies to every subsequent flush.\n   * @param _gasLimit New gas limit shared by this chain's reward managers.\n   */\n  function setCollectFeesGasLimit(uint256 _gasLimit) external;\n\n  /**\n   * @notice Mints `ReceiptToken` to the `EmissionsHandler` and calls it back per recipient. Gauge only.\n   * @dev Reverts `ChainNotActiveOrSunset` unless the chain is `Active` or `Sunset`, though the settled entitlement\n   *      survives the pause. Reverts `GaugeNotRegistered` for other callers and `CeilingExceeded` above the\n   *      gauge's headroom `ceiling - claimed - surplus`.\n   * @dev `claimed` is raised before the mint; the callback MUST NOT rely on further `LeafVoter` writes.\n   * @param _recipients Recipients for the per-leg delivery (LP, referral).\n   * @param _amounts Per-leg amounts of `ReceiptToken`.\n   */\n  function mintEmissions(address[] calldata _recipients, uint128[] calldata _amounts) external;\n\n  /**\n   * @notice Burns the caller's `ReceiptToken` and dispatches a `Redeem` message to root to mint `TOKEN`.\n   * @dev Reverts `ChainNotActiveOrSunset` unless the chain is `Active` or `Sunset`, and `AmountTooLow` below\n   *      `MIN_REDEEM_AMOUNT`.\n   * @dev `surplusAccrued` rides in the payload so root books it into `reportedSurplus`.\n   * @param _amount Amount of `ReceiptToken` to burn and `TOKEN` to mint on root.\n   * @param _recipient Address that receives the minted `TOKEN` on root.\n   * @param _gasLimit Execution gas reserved for the destination handler.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function redeem(uint256 _amount, address _recipient, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /**\n   * @notice Claims fee and incentive rewards through the LeafVoter in one transaction.\n   * @dev Callable by the veNFT's registered operator or the Leaf MessageOrchestrator. Fee claims are processed\n   *      before incentive claims. Unregistered managers are skipped; registered-manager reverts bubble to make an\n   *      inbound claim message retryable.\n   * @param _tokenId The veNFT token ID to claim for.\n   * @param _recipient Address to receive the claimed rewards.\n   * @param _feeClaims Fee claim requests to forward.\n   * @param _incentiveClaims Incentive claim requests to forward.\n   */\n  function claimRewards(\n    uint256 _tokenId,\n    address _recipient,\n    FeeClaim[] calldata _feeClaims,\n    IncentiveClaim[] calldata _incentiveClaims\n  ) external;\n\n  /**\n   * @notice Applies a chain-level allocation from root. Leaf MessageOrchestrator only.\n   * @dev Additive, never an overwrite, so it cannot resurrect a budget `deallocate` already removed. Carries no\n   *      gauges, is never cooldown-gated, and never reverts on a well-formed call. Runs while `Suspended` with\n   *      the scalar forced to zero (root diverts that period to surplus); delta and snapshot still apply.\n   * @dev While the token holds no gauge weight, the whole chain budget re-parks on `ZERO_GAUGE` anchored at the\n   *      latest shape, so a park whose stored shape expired revives on the next message, poke included.\n   * @param _tokenId Originating tokenId.\n   * @param _allocationDelta Voting power added to the tokenId's chain budget (always an increase).\n   * @param _emissionsPerVP New global emissions per voting power, `PRECISION`-scaled; zero while `Suspended`.\n   * @param _refreshEmissionsPerVP Newest chain allocation seen; only then is `_emissionsPerVP` written.\n   * @param _refreshShape Newest shape the token has seen; only then is `latestTokenSnapshot` updated.\n   * @param _snapshot Live VE shape; stored as `latestTokenSnapshot` when newest.\n   */\n  function applyChainAllocation(\n    uint256 _tokenId,\n    uint128 _allocationDelta,\n    uint256 _emissionsPerVP,\n    bool _refreshEmissionsPerVP,\n    bool _refreshShape,\n    TokenSnapshot calldata _snapshot\n  ) external;\n\n  /**\n   * @notice Applies a gauge distribution from root. Leaf MessageOrchestrator only.\n   * @dev Full overwrite: omitted gauges are cleared and budget above `Σ _gauges` parks on `ZERO_GAUGE`.\n   * @dev Reverts `CooldownActive` while the cooldown runs, so the transport redelivers later without spending\n   *      the token's reduction, and `AllocationExpired` past `_expiry`.\n   * @param _tokenId Originating tokenId.\n   * @param _expiry Root-stamped deadline; the message expires once `block.timestamp` passes it.\n   * @param _emissionsPerVP Global emissions-per-VP scalar at dispatch, `PRECISION`-scaled.\n   * @param _refreshEmissionsPerVP Newest message the leaf has seen; only then is `_emissionsPerVP` written.\n   * @param _refreshShape Newest shape the token has seen. If false, the vote books at the stored shape instead.\n   * @param _newSnapshot Live sAERO position state at dispatch time.\n   * @param _gauges Per-gauge allocations on this chain.\n   * @return _callParamsList One entry per touched gauge whose reward checkpoint this call already drove.\n   */\n  function applyGaugeAllocations(\n    uint256 _tokenId,\n    uint48 _expiry,\n    uint256 _emissionsPerVP,\n    bool _refreshEmissionsPerVP,\n    bool _refreshShape,\n    TokenSnapshot calldata _newSnapshot,\n    GaugeAllocation[] calldata _gauges\n  ) external returns (CheckpointData[] memory _callParamsList);\n\n  /**\n   * @notice Adds `_reduction` to a tokenId's accumulated cooldown reduction. Leaf MessageOrchestrator only.\n   * @dev Additive, so grants stack and order does not matter; the `uint48` add reverts on overflow.\n   * @param _tokenId veNFT id whose accumulated cooldown reduction increases.\n   * @param _reduction Seconds added.\n   */\n  function applyCooldownReduction(uint256 _tokenId, uint48 _reduction) external;\n\n  /**\n   * @notice Clears a token's gauge distribution here and cuts its chain budget. Leaf MessageOrchestrator only.\n   * @dev Subtracts rather than zeroes, so order against `AllocateChain` deltas booked before the drain does not\n   *      matter; the remaining budget parks on `ZERO_GAUGE`. Clamped at zero, so `_amount >= chainAllocation`\n   *      is the full unwind. Runs whatever the chain status is.\n   * @dev Clamping under-corrects a post-resume delta, so governance must not resume the chain until\n   *      `EmergencyDeallocationApplied` signals delivery (see `IVoter.setChainStatus`).\n   * @param _tokenId veNFT id whose position on the chain is reduced.\n   * @param _amount Chain budget root drained; subtracted from `chainAllocation` (clamped at zero).\n   */\n  function applyEmergencyDeallocation(uint256 _tokenId, uint128 _amount) external;\n\n  /**\n   * @notice Sets a tokenId's operator. Leaf MessageOrchestrator only.\n   * @dev Unconditional overwrite that never reverts on a well-formed call; `address(0)` clears it.\n   * @param _tokenId The tokenId whose operator is being assigned.\n   * @param _operator The new operator address, or `address(0)` to clear.\n   */\n  function setOperator(uint256 _tokenId, address _operator) external;\n\n  /**\n   * @notice Spreads the tokenId's `chainAllocation` budget across gauges. Operator only.\n   * @dev Reverts `ChainNotActiveOrSunset`, `LocalVotingDisabled`, `NotOperator`, `CooldownActive`,\n   *      `StakeSnapshotMissing`, `ExceedsMaxGauges`, and `ChainAllocationMismatch`. Entries must be strictly\n   *      ascending with non-zero amounts. An expired stake may only submit the lone `DEALLOC_GAUGE` sentinel\n   *      returning its whole budget; any other list reverts `StakeExpired`. A sunset chain accepts only that\n   *      same lone sentinel; any other list, empty included, reverts `SunsetDeallocOnly`.\n   * @dev `payable` because a `DEALLOC_GAUGE` entry returns that amount to root in the same call, so `msg.value`\n   *      must cover the quoted transport fee (excess refunded). No sentinel, no value needed.\n   * @param _tokenId The tokenId to allocate with.\n   * @param _gauges Full overwrite: omitted gauges are cleared, budget above `Σ _gauges` parks on `ZERO_GAUGE`.\n   */\n  function allocateGauges(uint256 _tokenId, GaugeAllocation[] calldata _gauges) external payable;\n\n  /**\n   * @notice Register a gauge on the voter, initializing the gauge state that\n   *         settlement and allocation read.\n   * @dev GaugeManager only. Settles the chain index to `block.timestamp`, then\n   *      seeds the gauge's settlement cursor from the chain cursor. Reverts on\n   *      the zero address and an already-registered gauge. Relationship\n   *      validation is owned by `FactoryRegistry.registerGauge` in the same\n   *      transaction. Emits `GaugeRegistered`, plus `GaugeActivated` when the\n   *      module activates at registration.\n   * @param _gauge The gauge address to register.\n   * @param _activate Whether the gauge activates at registration, from the\n   *                  creating module's activation policy.\n   */\n  function registerGauge(address _gauge, bool _activate) external;\n\n  /**\n   * @notice Activate a registered gauge so later allocations reach it instead of `ZERO_GAUGE`. Activation is\n   *         one-way.\n   * @dev GaugeManager only. Settles the chain index to `block.timestamp`, then settles the gauge so its cursor\n   *      advances from registration to activation. Inactive gauges are never routable, so the settled window is\n   *      weightless. Reverts `GaugeNotRegistered` for an unregistered gauge and `ZERO_GAUGE`, and\n   *      `GaugeAlreadyActivated` for an activated gauge. Emits `GaugeActivated` with the effective activation\n   *      cursor.\n   * @param _gauge The registered gauge address to activate.\n   */\n  function activateGauge(address _gauge) external;\n\n  /**\n   * @notice Settles the chain index and then `_gauge`, returning its cumulative reward share. Permissionless.\n   * @dev Returns `0` without settling for an unregistered gauge, so it never reverts. Never calls the gauge.\n   * @param _gauge The gauge to settle.\n   * @return _cumulativeRewardShare Cumulative capped effective-share (TOKEN units) after settling.\n   */\n  function settleGauge(address _gauge) external returns (uint256 _cumulativeRewardShare);\n\n  /**\n   * @notice Forfeits surplus the caller cannot distribute (Idle Gauge, Early Exit). Registered gauge only.\n   * @dev Reverts `GaugeNotRegistered`. `_amount` is clamped to the headroom `ceiling - claimed - surplus`, then\n   *      added to the gauge's `surplus` and to the chain-level `surplusAccrued`.\n   * @param _amount The surplus the calling gauge is forfeiting.\n   */\n  function forfeitEmissions(uint128 _amount) external;\n\n  /**\n   * @notice Sets whether a tokenId may route weight onto activated gauges whose emission cap is zero,\n   *         positioning for fee recovery while the zero cap keeps the gauge's emissions in surplus. When unset,\n   *         such allocations redirect to `ZERO_GAUGE`. Inactive gauges are never routable regardless of this\n   *         flag.\n   * @dev `TOKEN_WHITELIST_ROLE` only.\n   * @param _tokenId The tokenId whose flag is being set.\n   * @param _allowed The new flag value.\n   */\n  function setCanVoteForZeroCapGauges(uint256 _tokenId, bool _allowed) external;\n\n  /**\n   * @notice Opens or closes the local `allocateGauges` path. `VOTER_CONFIG_ROLE` only.\n   * @dev Defaults to false; while closed `allocateGauges` reverts `LocalVotingDisabled`, bridged path unchanged.\n   * @param _enabled New switch value.\n   */\n  function setLocalVotingEnabled(bool _enabled) external;\n\n  /**\n   * @notice Sets the minimum seconds between local allocations for a tokenId. `VOTER_CONFIG_ROLE` only.\n   * @param _allocationCooldown The new cooldown duration in seconds.\n   */\n  function setAllocationCooldown(uint48 _allocationCooldown) external;\n\n  /**\n   * @notice Sets the cap on a tokenId's accumulated cooldown reduction. `VOTER_CONFIG_ROLE` only.\n   * @dev `applyCooldownReduction` clamps here instead of reverting, so a redelivery never reverts forever.\n   * @dev Zero is the default and disables reductions. Any cap at or above `allocationCooldown` is unbounded.\n   * @param _maxAccumulatedCooldownReduction The new accumulation cap, in seconds.\n   */\n  function setMaxAccumulatedCooldownReduction(uint48 _maxAccumulatedCooldownReduction) external;\n\n  /**\n   * @notice Sets the minimum duration for new incentive programs. `VOTER_CONFIG_ROLE` only.\n   * @param _minIncentiveDuration The new minimum duration in seconds.\n   */\n  function setMinIncentiveDuration(uint48 _minIncentiveDuration) external;\n\n  /**\n   * @notice Sets the per-chain cap on gauges a tokenId may allocate to locally. `VOTER_CONFIG_ROLE` only.\n   * @dev Leaf-owned; root enforces nothing here. Zero is the default and bricks `allocateGauges`.\n   * @param _maxGauges The new gauge-count cap.\n   */\n  function setMaxGauges(uint256 _maxGauges) external;\n\n  /**\n   * @notice Sets the chain's operational status. `CHAIN_STATUS_ROLE` only.\n   * @dev Rejects a `None` target (`InvalidStatus`) and same-value writes; `Suspended` only exits to `Active`\n   *      or `Sunset` and `Sunset` only exits to `Suspended` (`InvalidChainStatusTransition`). Settles the\n   *      index at the old rate up to the flip; a pre-settling message can bank accrual past it, so the\n   *      boundary is `max(flip, lastSettlement)`.\n   * @dev Reactivating a sunset leaf routes through `Suspended` first, so the in-flight deallocation set can\n   *      drain before the resume — see the procedure on `IVoter.setChainStatus`.\n   * @dev Entering `Suspended` or `Sunset` forces `emissionsPerVP` to zero until the first root dispatch after\n   *      a resume to `Active`. `allocateGauges`, `redeem` and `mintEmissions` stay open\n   *      under `Active` and `Sunset` and close under everything else; `Deallocate` still dispatches. Flip leaf\n   *      before root when suspending or sunsetting and resume root before leaf, so the gap under-emits.\n   * @param _status The new chain status.\n   */\n  function setChainStatus(ChainStatus _status) external;\n\n  /**\n   * @notice Projects a gauge's cumulative reward share to `block.timestamp` without writing.\n   * @dev Equals what `settleGauge(_gauge)` would return in this block. Returns `0` for an unregistered gauge.\n   * @param _gauge The gauge to project.\n   * @return _cumulativeRewardShare Projected cumulative capped effective-share (TOKEN units).\n   */\n  function projectedCumulativeRewardShare(address _gauge) external view returns (uint256 _cumulativeRewardShare);\n\n  /*//////////////////////////////////////////////////////////////\n                                VARIABLES\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Sink for weight aimed at gauges that cannot receive emissions; it accrues there as surplus.\n   *         Allocations to unregistered or unactivated gauges, and to zero-cap gauges the tokenId is not\n   *         whitelisted for, are redirected here.\n   * @return _zeroGauge The sink address (`address(0)`).\n   */\n  function ZERO_GAUGE() external view returns (address _zeroGauge);\n\n  /**\n   * @notice Minimum redeem amount, `1_000_000` (one unit in pips), so the Splitter share cannot round to zero.\n   * @return _minRedeemAmount The minimum redeem amount.\n   */\n  function MIN_REDEEM_AMOUNT() external view returns (uint256 _minRedeemAmount);\n\n  /**\n   * @notice Leaf-side messaging orchestrator this voter dispatches through. Set at deployment, immutable.\n   * @return _orchestrator The bound leaf messaging orchestrator.\n   */\n  function ORCHESTRATOR() external view returns (ILeafMessageOrchestrator _orchestrator);\n\n  /**\n   * @notice `ReceiptToken` burned on redeem. Set at deployment, immutable.\n   * @return _receiptToken The bound `ReceiptToken`.\n   */\n  function RECEIPT_TOKEN() external view returns (IReceiptToken _receiptToken);\n\n  /**\n   * @notice `EmissionsHandler` that receives `ReceiptToken` from `mintEmissions` and the callback.\n   * @return _emissionsHandler Configured handler.\n   */\n  function EMISSIONS_HANDLER() external view returns (address _emissionsHandler);\n\n  /**\n   * @notice FactoryRegistry queried for per-gauge emission caps and reward\n   *         contracts during settlement. Set at deployment, immutable.\n   * @return _factoryRegistry The configured FactoryRegistry.\n   */\n  function FACTORY_REGISTRY() external view returns (IFactoryRegistry _factoryRegistry);\n\n  /**\n   * @notice GaugeManager authorized for the gauge-lifecycle writes,\n   *         `registerGauge` and `activateGauge`. Set at deployment, immutable.\n   * @return _gaugeManager The configured GaugeManager.\n   */\n  function GAUGE_MANAGER() external view returns (address _gaugeManager);\n\n  /**\n   * @notice Operational status, `Active` by default. `allocateGauges`, `redeem` and `mintEmissions` stay open\n   *         under `Active` and `Sunset` and are blocked under every other value.\n   * @return _status Current chain status.\n   */\n  function chainStatus() external view returns (ChainStatus _status);\n\n  /**\n   * @notice Latest emissions-per-VP scalar from root; written only on a fresh message, zero while `Suspended`\n   *         or `Sunset`.\n   * @return _emissionsPerVP Global emissions per unit voting power, `PRECISION`-scaled.\n   */\n  function emissionsPerVP() external view returns (uint256 _emissionsPerVP);\n\n  /**\n   * @notice Cumulative AERO rewards per unit of chain weight; only ever increases.\n   * @return _index Current accumulator index.\n   */\n  function index() external view returns (uint256 _index);\n\n  /**\n   * @notice Time-weighted chain accumulator: `emissionsPerVP` integrated against absolute (unix-epoch) time,\n   *         stored doubled. Paired with `index` it prices a decaying gauge's share exactly across a scalar\n   *         change, matching root.\n   * @return _timeIndex Current time-weighted accumulator value, doubled.\n   */\n  function timeIndex() external view returns (uint256 _timeIndex);\n\n  /**\n   * @notice Timestamp `index` is settled to. May be ahead of `block.timestamp` after a pre-settling message.\n   * @return _ts Last chain settlement timestamp.\n   */\n  function lastSettlement() external view returns (uint48 _ts);\n\n  /**\n   * @notice Snapshot of `index` at each weekly boundary; per-gauge settlement reads it for per-segment shares.\n   * @param _boundary Weekly-aligned timestamp.\n   * @return _indexSnapshot Value of `index` snapshotted at `_boundary`.\n   */\n  function indexAtBoundary(uint48 _boundary) external view returns (uint256 _indexSnapshot);\n\n  /**\n   * @notice Snapshot of `timeIndex` at each weekly boundary; per-gauge settlement reads it for the slope correction.\n   * @param _boundary Weekly-aligned timestamp.\n   * @return _timeIndexSnapshot Value of `timeIndex` snapshotted at `_boundary`.\n   */\n  function timeIndexAtBoundary(uint48 _boundary) external view returns (uint256 _timeIndexSnapshot);\n\n  /**\n   * @notice Whether a gauge is activated for direct allocation routing. Cheaper than reading `gaugeStates`.\n   * @param _gauge Gauge address to query.\n   * @return _isActivated Whether the gauge is activated.\n   */\n  function isActivated(address _gauge) external view returns (bool _isActivated);\n\n  /**\n   * @notice Per-gauge settlement state.\n   * @param _gauge Gauge address to query.\n   * @return _ceiling Cumulative effective share credited to the gauge.\n   * @return _claimed Cumulative emissions minted by the claim flow.\n   * @return _lastSettlement Timestamp of the gauge's last settlement.\n   * @return _isRegistered Whether the gauge was produced by an approved factory.\n   * @return _isActivated Whether the gauge is activated for direct allocation routing.\n   * @return _surplus Cumulative surplus attributed to the gauge.\n   * @return _lastIndex Snapshot of `index` at the gauge's last settlement.\n   * @return _lastTimeIndex Snapshot of `timeIndex` at the gauge's last settlement.\n   * @return _point Decaying weight of the gauge.\n   */\n  function gaugeStates(address _gauge)\n    external\n    view\n    returns (\n      uint128 _ceiling,\n      uint128 _claimed,\n      uint48 _lastSettlement,\n      bool _isRegistered,\n      bool _isActivated,\n      uint128 _surplus,\n      uint256 _lastIndex,\n      uint256 _lastTimeIndex,\n      Point memory _point\n    );\n\n  /**\n   * @notice Scheduled slope reduction for a gauge at a weekly expiry boundary.\n   * @param _gauge Gauge address to query.\n   * @param _expiry Expiry timestamp.\n   * @return _slopeDelta Slope reduction scheduled at `_expiry`.\n   */\n  function gaugeSlopeChanges(address _gauge, uint48 _expiry) external view returns (int128 _slopeDelta);\n\n  /**\n   * @notice Packed per-tokenId allocation state.\n   * @dev `chainAllocation` is raised by `applyChainAllocation`, cut by `applyEmergencyDeallocation` (clamped at\n   *      zero), and bounds the incoming gauge sum.\n   * @param _tokenId veNFT id to query.\n   * @return _operator The tokenId's operator, or `address(0)` if unset.\n   * @return _lastAllocated Last-allocated timestamp.\n   * @return _canVoteForZeroCapGauges True when the token may route weight onto activated zero-cap gauges.\n   * @return _chainAllocation Chain allocation budget for the tokenId.\n   */\n  function tokenStates(uint256 _tokenId)\n    external\n    view\n    returns (address _operator, uint48 _lastAllocated, bool _canVoteForZeroCapGauges, uint128 _chainAllocation);\n\n  /**\n   * @notice Shape the token's booked gauge weight is measured with. Read by reward contracts at checkpoint.\n   * @param _tokenId veNFT id to query.\n   * @return _staked AERO staked in the position at dispatch time.\n   * @return _stakeEnd Stake expiry; `0` for a permanent stake.\n   * @return _isPermanent True for a permanent stake.\n   */\n  function tokenSnapshot(uint256 _tokenId) external view returns (uint128 _staked, uint48 _stakeEnd, bool _isPermanent);\n\n  /**\n   * @notice Newest root-dispatched `TokenSnapshot` for a tokenId, applied or not.\n   * @dev Never behind `tokenSnapshot`; the next gauge-iterating operation consumes it and the two match again.\n   * @param _tokenId veNFT id to query.\n   * @return _staked AERO staked in the position at dispatch time.\n   * @return _stakeEnd Stake expiry; `0` for a permanent stake.\n   * @return _isPermanent True for a permanent stake.\n   */\n  function latestTokenSnapshot(uint256 _tokenId)\n    external\n    view\n    returns (uint128 _staked, uint48 _stakeEnd, bool _isPermanent);\n\n  /**\n   * @notice Per-`(tokenId, effective gauge)` allocated weight; redirected weight aggregates on `ZERO_GAUGE`.\n   * @param _tokenId veNFT id to query.\n   * @param _gauge Effective gauge address to query.\n   * @return _allocated Weight the tokenId currently has on the gauge.\n   */\n  function allocations(uint256 _tokenId, address _gauge) external view returns (uint128 _allocated);\n\n  /**\n   * @notice Cumulative AERO on this chain that will not be redeemed; only ever increases, sent in every REDEEM.\n   * @return _surplus Cumulative surplus.\n   */\n  function surplusAccrued() external view returns (uint256 _surplus);\n\n  /**\n   * @notice Whether the local `allocateGauges` path is open. False until governance opens it.\n   * @return _enabled Current switch value.\n   */\n  function localVotingEnabled() external view returns (bool _enabled);\n\n  /**\n   * @notice Minimum seconds between local allocations for a tokenId.\n   * @return _cooldown Cooldown duration.\n   */\n  function allocationCooldown() external view returns (uint48 _cooldown);\n\n  /**\n   * @notice Cap on a tokenId's accumulated cooldown reduction. Zero, the default, disables reductions.\n   * @return _maxAccumulatedCooldownReduction The accumulation cap, in seconds.\n   */\n  function maxAccumulatedCooldownReduction() external view returns (uint48 _maxAccumulatedCooldownReduction);\n\n  /**\n   * @notice Minimum duration for new incentive programs.\n   * @return _minIncentiveDuration The minimum duration in seconds.\n   */\n  function minIncentiveDuration() external view returns (uint48 _minIncentiveDuration);\n\n  /**\n   * @notice Per-chain cap on gauges a tokenId may allocate to locally. Leaf-owned; root holds no equivalent.\n   * @return _maxGauges The gauge-count cap.\n   */\n  function maxGauges() external view returns (uint256 _maxGauges);\n\n  /**\n   * @notice Reduction accrued for a tokenId, in seconds; the next allocation consumes it, clamped to the cooldown.\n   * @param _tokenId veNFT id.\n   * @return _reduction Accumulated reduction in seconds, or zero if none.\n   */\n  function accumulatedCooldownReduction(uint256 _tokenId) external view returns (uint48 _reduction);\n\n  /*//////////////////////////////////////////////////////////////\n                                  VIEWS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Operator authorized to run the local `allocateGauges` for a tokenId.\n   * @param _tokenId veNFT id to query.\n   * @return _operator The tokenId's operator, or `address(0)` if unset.\n   */\n  function operator(uint256 _tokenId) external view returns (address _operator);\n\n  /**\n   * @notice Effective gauges the tokenId has weight on. Excludes `ZERO_GAUGE`: read parked weight with\n   *         `allocations(_tokenId, ZERO_GAUGE)`.\n   * @param _tokenId veNFT id to query.\n   * @return _gauges The set's values as a memory array.\n   */\n  function allocatedGauges(uint256 _tokenId) external view returns (address[] memory _gauges);\n\n  /**\n   * @notice Returns the gas limit used by reward managers when flushing gauge fees.\n   * @return _gasLimit The gauge fee collection gas limit.\n   */\n  function collectFeesGasLimit() external view returns (uint256 _gasLimit);\n}\n"},"V3/src/interfaces/voter/IVoter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol';\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {IRootMessageOrchestrator} from 'V3/interfaces/bridge/IRootMessageOrchestrator.sol';\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IMinter} from 'V3/interfaces/minter/IMinter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\nimport {IVoterCommon} from 'V3/interfaces/voter/IVoterCommon.sol';\n\n/**\n * @title IVoter\n * @notice Root-chain Voter: types, errors and external surface for spreading veNFT voting power across chains.\n *         `CHAIN0` is the idle sink where parked power earns nothing; `TOKEN0` holds burned permanent power.\n */\ninterface IVoter is IVoterCommon, IAccessControl {\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Initial holders of the root voter's governance and operational roles.\n   * @param governor Governance role holder.\n   * @param configAdmin Configuration admin role holder.\n   * @param adapterAuthority Adapter configuration role holder.\n   * @param voterConfigurer Voter configuration role holder.\n   * @param chainConfigurer Chain registration role holder.\n   * @param chainStatusAuthority Chain status role holder.\n   * @param relayDeployer Relay deployment role holder.\n   * @param nativeWithdrawer Native withdrawal role holder.\n   * @param splitterConfigurer Splitter configuration role holder.\n   */\n  struct RoleHolders {\n    address governor;\n    address configAdmin;\n    address adapterAuthority;\n    address voterConfigurer;\n    address chainConfigurer;\n    address chainStatusAuthority;\n    address relayDeployer;\n    address nativeWithdrawer;\n    address splitterConfigurer;\n  }\n\n  /**\n   * @notice Dependencies, initial role holders and message lifetimes of the root voter.\n   * @dev Dependencies may be predicted addresses; construction makes no external calls.\n   * @param orchestrator Root message orchestrator.\n   * @param votingEscrow Voting escrow providing stake state.\n   * @param minter Minter providing the emission rate.\n   * @param token Emissions token minted by the minter.\n   * @param roles Initial governance and operational role holders.\n   * @param allocationLifetime Lifetime stamped on gauge dispatches.\n   * @param messageLifetime Lifetime stamped on claim and operator dispatches.\n   */\n  struct ConstructorParams {\n    address orchestrator;\n    address votingEscrow;\n    address minter;\n    address token;\n    RoleHolders roles;\n    uint48 allocationLifetime;\n    uint48 messageLifetime;\n  }\n\n  /**\n   * @notice One chain's additive voting-power delta plus its dispatch params.\n   * @dev `allocateChains` is additive and partial and owns only the chain-level ledger; gauges are an\n   *      `allocateGauges` / `allocate` concern.\n   * @param chainId Target chain identifier; strictly ascending across the input array, `CHAIN0` absent.\n   * @param delta AERO to ADD to this chain, drawn only from CHAIN0-parked power. `0` is a refresh poke.\n   * @param gasLimit Destination gas for the leaf `handle()` call. Zero only for the in-process root-chain entry.\n   * @param value Native fee forwarded to the orchestrator. Zero only for the root-chain entry.\n   */\n  struct ChainAllocationDispatch {\n    uint256 chainId;\n    uint128 delta;\n    uint256 gasLimit;\n    uint256 value;\n  }\n\n  /**\n   * @notice One chain's gauge distribution in a composed `allocate` call, with its dispatch params.\n   * @dev `allocate` checks the list against the `allocationChainAmounts` written earlier in the same call, then\n   *      runs the `allocateGauges` core, so `DEALLOC_GAUGE` is accepted and its return cost comes from `value`.\n   * @param chainId Target chain identifier; strictly ascending across the `_gaugeDispatches` array.\n   * @param gasLimit Destination gas for the leaf `handle()` call. Zero only for the in-process root-chain entry.\n   * @param value Native fee forwarded to the orchestrator for this chain's gauge message.\n   * @param gauges Per-gauge allocations on `chainId`, strictly ascending by gauge address.\n   */\n  struct GaugeAllocationDispatch {\n    uint256 chainId;\n    uint256 gasLimit;\n    uint256 value;\n    GaugeAllocation[] gauges;\n  }\n\n  /**\n   * @notice Reward claim request and dispatch params for one chain.\n   * @param chainId Target chain identifier; strictly ascending across the input array.\n   * @param gasLimit Destination gas for the leaf `ClaimRewards` handler. Zero only for the in-process root chain.\n   * @param value Native fee forwarded to the orchestrator. Zero only for the root-chain entry.\n   * @param recipient Address that receives claimed rewards on the leaf.\n   * @param feeClaims Fee claim requests forwarded to the leaf voter.\n   * @param incentiveClaims Incentive claim requests forwarded to the leaf voter.\n   */\n  struct ClaimRewardsParams {\n    uint256 chainId;\n    uint256 gasLimit;\n    uint256 value;\n    address recipient;\n    ILeafVoter.FeeClaim[] feeClaims;\n    ILeafVoter.IncentiveClaim[] incentiveClaims;\n  }\n\n  /**\n   * @notice Per-tokenId record written on every `allocateChains`.\n   * @param committed AERO size at the last allocation; unmoved when VE `staked` grows without a new allocation.\n   * @param lastStakeEnd Stake expiry at the last allocation; `0` for a permanent stake.\n   * @param lastAllocated Timestamp of the last chain-level allocation.\n   * @param isPermanent True for a permanent stake; the permanence signal the point math reads.\n   */\n  struct TokenState {\n    uint128 committed;\n    uint48 lastStakeEnd;\n    uint48 lastAllocated;\n    bool isPermanent;\n  }\n\n  /**\n   * @notice Per-chain state read and written together along the allocate, settle and redeem pipelines.\n   * @dev Ceiling accrues the chain weight against the global scalar over each week segment, exact for permanent\n   *      and decaying stakes alike. It reads two global accumulators: `index` (the scalar summed over time) and\n   *      `timeIndex` (the scalar summed weighted by absolute unix-epoch time, doubled). A decaying segment credits\n   *      its end weight against the first plus a slope correction from the second, so an infrequently-settled\n   *      chain accrues the same as a finely-settled one. With `Σ chainWeight == totalWeight`, `Σ ceilings` tracks\n   *      the minter schedule.\n   * @param point Aggregate voting power for the chain.\n   * @param ceiling Cumulative emissions the chain may claim.\n   * @param totalRedeemed Total `TOKEN` minted for the chain via redeem. Only ever increases.\n   * @param reportedSurplus High-water mark of unused-emissions surplus reported to root. Only ever increases.\n   *        Feeds the chain's `spendSurplus` pot, clamped there to `ceiling - totalRedeemed`. May exceed that\n   *        entitlement when the accepting redeem was backed by the donated buffer.\n   * @param cumulativeSuspendedSurplus Would-be ceiling growth caught while the chain is `Suspended`. Only ever\n   *        increases. Part of the chain's `spendSurplus` pot, netted against `surplusSpent`.\n   * @param surplusSpent Cumulative surplus minted via `spendSurplus`. Only ever increases. Netted against the\n   *        chain's pot to bound further spends.\n   * @param lastIndex The chain's cursor into the global `index`, set at its last ceiling settlement.\n   * @param lastTimeIndex The chain's cursor into the global `timeIndex`, set at its last ceiling settlement.\n   * @param donatedBuffer Donated `TOKEN` held for the chain's redeems, drawn once its ceiling is exhausted.\n   * @param status Operational status of the chain.\n   */\n  struct ChainState {\n    Point point;\n    uint256 ceiling;\n    uint256 totalRedeemed;\n    uint256 reportedSurplus;\n    uint256 cumulativeSuspendedSurplus;\n    uint256 surplusSpent;\n    uint256 lastIndex;\n    uint256 lastTimeIndex;\n    uint256 donatedBuffer;\n    ChainStatus status;\n  }\n\n  /**\n   * @notice Live external state read once at the top of an allocation call, before anything is dispatched.\n   * @dev Every dispatch hands control to a caller-supplied refund address that can reenter the VotingEscrow,\n   *      outside this contract's guard; reading once keeps every message of one call on the same position.\n   * @param staked Live VE staked amount.\n   * @param stakeEnd Live VE stake expiry; `0` for a permanent stake.\n   * @param emissionRate Minter emission rate backing every root rate and payload in the call.\n   * @param isPermanent True for a permanent stake, carried through to the leaf snapshot.\n   */\n  struct AllocationSnapshot {\n    uint128 staked;\n    uint48 stakeEnd;\n    uint256 emissionRate;\n    bool isPermanent;\n  }\n\n  /**\n   * @notice Per-tokenId token and VE state read once when the allocation pipeline starts. Pipeline-local.\n   * @param veStaked Current VE-staked AERO; the cap the booked total must stay within.\n   * @param prevCommitted The token's booked total at the prior allocation.\n   * @param veStakeEnd Current stake expiry; `0` for a permanent stake.\n   * @param oldStakeEnd `tokenStates[_tokenId].lastStakeEnd` at the prior allocation.\n   * @param veIsPermanent True for the live permanent stake, shipped to the leaf snapshot and used by the point math.\n   * @param oldIsPermanent True for the stored permanent shape (`tokenStates[_tokenId].isPermanent`).\n   */\n  struct AllocationContext {\n    uint128 veStaked;\n    uint128 prevCommitted;\n    uint48 veStakeEnd;\n    uint48 oldStakeEnd;\n    bool veIsPermanent;\n    bool oldIsPermanent;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Emitted when permanent voting power parked on `TOKEN0` / `CHAIN0` is burned.\n   * @param _caller Address that triggered the burn (the VotingEscrow's default VPM).\n   * @param _amount AERO removed from `TOKEN0`'s committed and from the chain0 and total permanent balances.\n   */\n  event Burned(address indexed _caller, uint128 _amount);\n\n  /**\n   * @notice Emitted when a batch of chain0 allocation moves is mirrored from a VotingEscrow rebalance.\n   * @param _sources Source deltas drained from the chain0 ledger, as forwarded by VotingEscrow.\n   * @param _destinations Destination deltas credited to the chain0 ledger, mint sentinels already resolved.\n   */\n  event Chain0Rebalanced(IVotingEscrow.SourceDelta[] _sources, IVotingEscrow.DestinationDelta[] _destinations);\n\n  /**\n   * @notice Emitted when a cooldown reduction is dispatched to a leaf. Root keeps no reduction state.\n   * @param _tokenId veNFT id whose cooldown reduction is being dispatched.\n   * @param _chainId Destination chain the reduction applies to.\n   * @param _reduction Reduction shipped to the leaf, in seconds.\n   */\n  event CooldownReductionDispatched(uint256 indexed _tokenId, uint256 indexed _chainId, uint48 _reduction);\n\n  /**\n   * @notice Emitted when a reward claim is dispatched to a leaf.\n   * @param _tokenId veNFT id whose rewards are being claimed.\n   * @param _chainId Destination chain the reward claim targets.\n   * @param _recipient Address that receives any claimed rewards.\n   */\n  event RewardsClaimDispatched(uint256 indexed _tokenId, uint256 indexed _chainId, address indexed _recipient);\n\n  /**\n   * @notice Emitted when a `Redeem` message is processed and the recipient is paid.\n   * @param _chainId Source chain id of the processed redeem message.\n   * @param _recipient Address that received the `TOKEN`.\n   * @param _amount Amount of `TOKEN` the recipient received, minted and, past the ceiling, paid from the\n   *                chain's donated buffer.\n   * @param _surplusReported Reported surplus high-water mark recorded for the chain after the redeem.\n   */\n  event RedeemProcessed(\n    uint256 indexed _chainId, address indexed _recipient, uint256 _amount, uint256 _surplusReported\n  );\n\n  /**\n   * @notice Emitted when `TOKEN` is donated into a chain's redeem buffer.\n   * @param _chainId Chain whose donated buffer was credited.\n   * @param _donor Address the donation was pulled from.\n   * @param _amount Amount of `TOKEN` added to the buffer.\n   */\n  event Donated(uint256 indexed _chainId, address indexed _donor, uint256 _amount);\n\n  /**\n   * @notice Emitted when a redeem draws on a chain's donated buffer for the part its ceiling cannot cover.\n   * @param _chainId Chain whose donated buffer was drawn.\n   * @param _amount Amount of `TOKEN` paid out of the buffer instead of minted.\n   */\n  event BufferDrawn(uint256 indexed _chainId, uint256 _amount);\n\n  /**\n   * @notice Emitted when a `Deallocate` message is processed and the power is credited back to `CHAIN0`.\n   * @param _chainId Origin chain id the voting power was deallocated from.\n   * @param _tokenId veNFT id whose voting power was returned to `CHAIN0`.\n   * @param _amount Voting power credited to `CHAIN0`, clamped to the token's origin-chain balance.\n   */\n  event DeallocationProcessed(uint256 indexed _chainId, uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when a token owner pulls power off a `Suspended` chain via `emergencyDeallocate`.\n   * @param _chainId Chain id the voting power was pulled from.\n   * @param _tokenId veNFT id whose voting power was returned to `CHAIN0`.\n   * @param _amount Voting power credited to `CHAIN0`, equal to the token's booked balance on the chain.\n   */\n  event EmergencyDeallocated(uint256 indexed _chainId, uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when a token's chain budgets are allocated via `allocateChains` or `allocate`.\n   * @param _tokenId veNFT id whose chain allocation was applied.\n   * @param _allocations The per-chain dispatch batch; each `delta` is added to that chain's booked budget.\n   */\n  event ChainsAllocated(uint256 indexed _tokenId, ChainAllocationDispatch[] _allocations);\n\n  /**\n   * @notice Emitted when a token's gauge distribution for a chain is dispatched to the leaf.\n   * @param _tokenId veNFT id whose gauges were allocated.\n   * @param _chainId Destination chain the gauge distribution targets.\n   * @param _gauges The requested per-gauge allocation shipped to the leaf.\n   */\n  event GaugesAllocated(uint256 indexed _tokenId, uint256 indexed _chainId, GaugeAllocation[] _gauges);\n\n  /**\n   * @notice Emitted when a withdrawn token's root allocation ledger is cleared.\n   * @param _tokenId veNFT id whose ledger was cleared.\n   * @param _clearedChains Chains the token still had booked amounts on, all dropped by this call.\n   */\n  event TokenCleared(uint256 indexed _tokenId, uint256[] _clearedChains);\n\n  /**\n   * @notice Emitted when a token's unbooked voting power is parked onto `CHAIN0` via `parkOnChain0`.\n   * @param _tokenId veNFT id whose voting power was parked.\n   * @param _amount Voting power booked onto `CHAIN0`.\n   */\n  event ParkedOnChain0(uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when the gauge-message lifetime is updated.\n   * @param _allocationLifetime New lifetime in seconds, stamped onto every gauge dispatch as an absolute expiry.\n   */\n  event AllocationLifetimeSet(uint48 _allocationLifetime);\n\n  /**\n   * @notice Emitted when the claim and operator message lifetime is updated.\n   * @param _messageLifetime New lifetime in seconds, stamped onto every claim and operator dispatch as an absolute\n   *                       expiry.\n   */\n  event MessageLifetimeSet(uint48 _messageLifetime);\n\n  /**\n   * @notice Emitted when a new chain is registered.\n   * @param _chainId Newly registered chain id.\n   */\n  event ChainRegistered(uint256 indexed _chainId);\n\n  /**\n   * @notice Emitted when a chain's operational status changes.\n   * @param _chainId Chain whose status was updated.\n   * @param _status New status.\n   */\n  event ChainStatusSet(uint256 indexed _chainId, ChainStatus _status);\n\n  /**\n   * @notice Emitted when a chain's emergency-deallocation authorization switch is set.\n   * @param _chainId Chain whose switch was updated.\n   * @param _allowed `true` authorizes `emergencyDeallocate` for the current suspension.\n   */\n  event EmergencyDeallocationAllowedSet(uint256 indexed _chainId, bool _allowed);\n\n  /**\n   * @notice Emitted when a tokenId's per-chain operator is updated.\n   * @param _tokenId Token whose operator was updated.\n   * @param _chainId Chain the operator applies to.\n   * @param _operator New operator address. Zero clears the slot.\n   */\n  event OperatorSet(uint256 indexed _tokenId, uint256 indexed _chainId, address _operator);\n\n  /**\n   * @notice Emitted when governance mints accumulated surplus via `spendSurplus`.\n   * @param _chainId Chain whose surplus pot was spent.\n   * @param _recipient Address that received the minted `TOKEN`.\n   * @param _amount Amount of `TOKEN` minted from the pot.\n   */\n  event SurplusSpent(uint256 indexed _chainId, address indexed _recipient, uint256 _amount);\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Thrown when an operation requires an `Active` chain.\n   * @param _chainId Chain that is not `Active`.\n   */\n  error ChainNotActive(uint256 _chainId);\n\n  /**\n   * @notice Thrown when an operation is unavailable while a chain is `Paused`.\n   * @param _chainId Chain that is `Paused`.\n   */\n  error ChainPaused(uint256 _chainId);\n\n  /**\n   * @notice Thrown when a dispatch targets a chain that is neither `Active` nor `Sunset`.\n   * @param _chainId Chain that does not accept dispatches.\n   */\n  error ChainNotActiveOrSunset(uint256 _chainId);\n\n  /// @notice Thrown when a redeem plus the reserved surplus cannot be covered by the ceiling and donated buffer.\n  error CeilingExceeded();\n\n  /// @notice Thrown when the caller is not authorized to call the function.\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown by `allocateGauges` / `allocate` when Σ gauge `allocated` — including any `DEALLOC_GAUGE` or\n   *         explicit `ZERO_GAUGE` idle entry — does not exactly equal the token's power booked on the chain.\n   * @dev Root repeats the leaf's check, so a mis-summed vote is rejected before dispatch, not after a round trip.\n   * @param _chainId Chain whose booked allocation the gauge sum did not match.\n   */\n  error ChainAllocationMismatch(uint256 _chainId);\n\n  /**\n   * @notice Thrown by `allocate` when `_gaugeDispatches` chainIds are not strictly ascending, which also\n   *         rejects duplicates and `CHAIN0`.\n   */\n  error GaugeDispatchesNotStrictlyAscending();\n\n  /**\n   * @notice Thrown when a non-root-chain dispatch entry carries a zero `gasLimit`. The root-chain entry\n   *         (`chainId == block.chainid`) is exempt: it is forwarded in-process with no destination metering.\n   * @param _chainId Chain missing a `gasLimit`.\n   */\n  error MissingDestinationGasLimit(uint256 _chainId);\n\n  /**\n   * @notice Thrown when allocation chainIds are not strictly ascending, which also rejects duplicates and\n   *         `CHAIN0`.\n   */\n  error AllocationsNotStrictlyAscending();\n\n  /// @notice Thrown when claim chainIds are not strictly ascending, which also rejects duplicates and `CHAIN0`.\n  error ClaimRewardsParamsNotStrictlyAscending();\n\n  /// @notice Thrown when `claimRewards` is called without any per-chain params or a param contains no reward claims.\n  error EmptyClaimRewardsParams();\n\n  /// @notice Thrown by `burn` when the requested amount exceeds `tokenStates[TOKEN0].committed`.\n  error InsufficientCommitted();\n\n  /// @notice Thrown by `burn` or `rebalanceChain0` when the amount exceeds a source's chain0 allocation.\n  error InsufficientChain0Allocation();\n\n  /**\n   * @notice Thrown by `rebalanceChain0` when a destination already holding chain0 allocation has a stored\n   *         `lastStakeEnd` that differs from the live VE stake expiry.\n   * @dev Reconcile it via `allocateChains` first, otherwise its old and new entries would span two stakeEnds.\n   */\n  error DstShapeStale();\n\n  /**\n   * @notice Thrown by the standalone `allocateGauges` when the live stake shape no longer matches the stored\n   *         root shape (`lastStakeEnd`).\n   * @dev The gauge path does not re-anchor root's chain state, so a mismatch would desync leaf gauge accrual\n   *      from the ceiling. Reconcile with an empty `allocateChains(tokenId, [], recipient)` and retry.\n   */\n  error StaleShape();\n\n  /**\n   * @notice Thrown by the gauge dispatch path when the token has been withdrawn (`staked == 0`).\n   * @dev A withdrawn token holds no allocation on any chain, so its only gauge message is the empty no-op.\n   *      Blocking it stops a `{staked: 0, stakeEnd: 0}` shape from ever reaching a leaf, where it would be\n   *      mistaken for a permanent stake.\n   */\n  error StakeWithdrawn();\n\n  /// @notice Thrown by `reduceCooldown` when `msg.sender` does not pass `VotingEscrow.isAuthorizedVPM`.\n  error NotVoterPaymentsModule();\n\n  /// @notice Thrown by a VotingEscrow-only entrypoint when the caller is not the VotingEscrow.\n  error NotVotingEscrow();\n\n  /**\n   * @notice Thrown when an `allocationLifetime` below `MIN_MESSAGE_LIFETIME` is configured, a lifetime short enough\n   *         to expire gauge dispatches in transit.\n   */\n  error AllocationLifetimeTooLow();\n\n  /**\n   * @notice Thrown when an `allocationLifetime` above `MAX_MESSAGE_LIFETIME` is configured, a lifetime long enough\n   *         to push the stamped uint48 expiry toward overflow.\n   */\n  error AllocationLifetimeTooHigh();\n\n  /**\n   * @notice Thrown when a `messageLifetime` below `MIN_MESSAGE_LIFETIME` is configured, a lifetime short enough to\n   *         expire claim and operator dispatches in transit.\n   */\n  error MessageLifetimeTooLow();\n\n  /**\n   * @notice Thrown when a `messageLifetime` above `MAX_MESSAGE_LIFETIME` is configured, a lifetime long enough to\n   *         push the stamped uint48 expiry toward overflow.\n   */\n  error MessageLifetimeTooHigh();\n\n  /// @notice Thrown by `burn` when `_amount` is zero, a call that would only emit a misleading event.\n  error ZeroAmount();\n\n  /// @notice Thrown by `reduceCooldown` when the requested reduction is zero, a no-op message.\n  error ZeroReduction();\n\n  /// @notice Thrown when `clearToken` targets `TOKEN0`, which holds burned power and is not a user token.\n  error Token0NotClearable();\n\n  /// @notice Thrown when a per-chain setter is called with `CHAIN0`, whose state is fixed at construction.\n  error Chain0NotConfigurable();\n\n  /**\n   * @notice Thrown when `registerChain` is called for an already registered chain.\n   * @param _chainId Chain that was already registered.\n   */\n  error ChainAlreadyRegistered(uint256 _chainId);\n\n  /**\n   * @notice Thrown when a per-chain setter targets a chain that has not been registered.\n   * @param _chainId Chain that is not in `_chains`.\n   */\n  error ChainNotRegistered(uint256 _chainId);\n\n  /**\n   * @notice Thrown by `processRedeem` when the origin chain is `Suspended`: redeem mints on root, so it waits\n   *         for resume and the transport redelivers.\n   */\n  error RouteSuspended();\n\n  /**\n   * @notice Thrown when `emergencyDeallocate` targets a chain that is not `Suspended`.\n   * @param _chainId Chain whose status is not `Suspended`.\n   */\n  error ChainNotSuspended(uint256 _chainId);\n\n  /**\n   * @notice Thrown when `emergencyDeallocate` runs on a chain whose emergency switch is off.\n   * @dev Governance enables it per suspension via `setEmergencyDeallocationAllowed`; it resets on every suspend.\n   * @param _chainId Chain whose switch is not enabled.\n   */\n  error EmergencyDeallocationNotAllowed(uint256 _chainId);\n\n  /// @notice Thrown when `emergencyDeallocate` targets a token with nothing booked on the suspended chain.\n  error NothingToDeallocate();\n\n  /**\n   * @notice Thrown when `spendSurplus` requests more than the chain's spendable surplus.\n   * @param _chainId Chain whose pot was insufficient.\n   * @param _spendable Spendable surplus after settling the chain.\n   */\n  error InsufficientSurplus(uint256 _chainId, uint256 _spendable);\n\n  /*//////////////////////////////////////////////////////////////\n                                EXTERNAL\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Add voting power to the tokenId's chains — additive and partial, chain-level ledger only.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Each `delta` is ADDED to that chain from\n   *      CHAIN0-parked power (`Σ delta ≤ chain0Parked`, else `InsufficientChain0Allocation`); unbooked power\n   *      must pass `parkOnChain0` first, and reductions go leaf-first through `deallocate`, never here.\n   * @dev A `delta == 0` entry is a refresh poke, allowed on any Active chain even with no position there, that\n   *      makes the leaf settle its index and re-read `emissionsPerVP`. A changed stake shape re-anchors every\n   *      allocated chain locally, with no extra messages.\n   * @param _tokenId veNFT id to allocate with.\n   * @param _chainDispatches Per-chain delta + dispatch params; strictly ascending chainIds, `CHAIN0` absent.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function allocateChains(\n    uint256 _tokenId,\n    ChainAllocationDispatch[] calldata _chainDispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Distribute a tokenId's already-assigned chain budget across gauges on one chain.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Root keeps no gauge state. The cooldown lives on the\n   *      leaf, which reverts while it runs so the transport redelivers, and spends any pending reduction there.\n   * @dev Full overwrite: `_gauges` must sum to EXACTLY the chain budget (else `ChainAllocationMismatch`), idle\n   *      power is an explicit `ZERO_GAUGE` entry with no automatic backfill, and gauges left out are cleared.\n   * @dev Open while the chain is `Active` or `Sunset`. A sunset chain only accepts the lone `DEALLOC_GAUGE`\n   *      sentinel returning the whole budget; any other list, empty included, reverts `SunsetDeallocOnly`.\n   *      New power cannot enter because `allocateChains` stays closed.\n   * @dev An expired stake may only submit the lone `DEALLOC_GAUGE` sentinel returning its whole budget; any\n   *      other list reverts `StakeExpired`.\n   * @param _tokenId veNFT id to distribute gauge weight for.\n   * @param _chainId Destination chain the gauges live on.\n   * @param _gauges Per-gauge allocations, strictly ascending by address. Empty clears the token's gauge weight.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function allocateGauges(\n    uint256 _tokenId,\n    uint256 _chainId,\n    GaugeAllocation[] calldata _gauges,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Assign chain budgets and distribute gauges for a tokenId in a single call.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Phase 1 runs the `allocateChains` pipeline, phase 2\n   *      checks each gauge list against the budgets just written and runs the `allocateGauges` core, so both sets\n   *      of rules apply unchanged.\n   * @dev `msg.value` must equal `Σ _chainDispatches.value + Σ _gaugeDispatches.value`, else `UnexpectedValue`.\n   *      Every `_gaugeDispatches` chain must be registered and `Active` or `Sunset`; a `Sunset` entry only\n   *      accepts the lone `DEALLOC_GAUGE` list.\n   * @param _tokenId veNFT id to allocate with.\n   * @param _chainDispatches Per-chain delta + dispatch params; strictly ascending chainIds, `CHAIN0` absent.\n   * @param _gaugeDispatches Per-chain gauge distributions; strictly ascending chainIds, `CHAIN0` absent.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function allocate(\n    uint256 _tokenId,\n    ChainAllocationDispatch[] calldata _chainDispatches,\n    GaugeAllocationDispatch[] calldata _gaugeDispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Dispatches fee and incentive reward claims to leaf voters.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Claim chainIds must be registered, `Active` or\n   *      `Sunset`, and strictly ascending. A non-root entry must provide destination gas. `msg.value` must equal\n   *      the sum of entry values.\n   * @dev Each payload encodes `_tokenId`, an absolute expiry of `block.timestamp + messageLifetime`, the recipient,\n   *      and both claim arrays. Fees are processed before incentives. The expiry bounds how long a stalled claim\n   *      stays executable on the leaf: the recipient is fixed at dispatch, so without it a claim held back past a\n   *      root-side token transfer could still pay the previous owner, including fees accrued after dispatch.\n   * @param _tokenId veNFT id to claim rewards for.\n   * @param _claimRewardsParams Per-chain reward claims and dispatch params.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function claimRewards(\n    uint256 _tokenId,\n    ClaimRewardsParams[] calldata _claimRewardsParams,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Donate `TOKEN` into a chain's redeem buffer, extra headroom redeems draw on once the chain's\n   *         ceiling is exhausted.\n   * @dev Permissionless. Pulls the amount from the caller, so it needs a prior approval. The buffer is tracked\n   *      next to the ceiling, never inside it: the ceiling stays pure accrued state and donated headroom stays\n   *      auditable on its own. Reverts `ChainNotRegistered` or `ZeroAmount`.\n   * @param _chainId Registered chain whose donated buffer is credited.\n   * @param _amount Amount of `TOKEN` to pull from the caller into the buffer.\n   */\n  function donate(uint256 _chainId, uint256 _amount) external;\n\n  /**\n   * @notice Inbound handler for `Redeem` messages from a leaf chain.\n   * @dev `ORCHESTRATOR` only. Applies the surplus max rule and the buffer solvency check before paying. The\n   *      part of the amount the ceiling covers is minted; any remainder is paid from the chain's donated\n   *      buffer, which keeps supply neutral for donated headroom. Reverts `CeilingExceeded` when the buffer\n   *      cannot cover the payout the ceiling headroom leaves unpaid, so the transport redelivers once accrual\n   *      or donations cover it. A surplus report may be stored past the chain's mint entitlement;\n   *      `spendableSurplus` clamps that excess out of the pot, so the buffer never funds a surplus mint.\n   * @dev A minted leg below the Minter's `MIN_MINT_AMOUNT` is paid entirely from the buffer when it can\n   *      absorb the full amount, so a sliver of headroom never stalls a covered redeem; otherwise the mint\n   *      reverts `AmountTooLow` and the transport redelivers once enough headroom accrues.\n   * @param _originChainId Source chain id of the inbound `Redeem` message.\n   * @param _amount Amount of `TOKEN` to pay the recipient.\n   * @param _recipient Address that receives the `TOKEN`.\n   * @param _surplusAccrued Surplus accumulator snapshot reported by the leaf chain.\n   */\n  function processRedeem(uint256 _originChainId, uint256 _amount, address _recipient, uint256 _surplusAccrued) external;\n\n  /**\n   * @notice Inbound handler for a `Deallocate` message: credit the power back to the token's `CHAIN0` balance\n   *         once the leaf confirms the removal.\n   * @dev `ORCHESTRATOR` only. Clamps `_amount` to the token's current origin-chain allocation, so a late or\n   *      duplicate message credits nothing, then moves it to `CHAIN0` at the stored shape and refreshes rates.\n   * @dev Carries no reentrancy guard, so a root-colocated leaf's synchronous return can land while the\n   *      allocation entrypoint that started it still holds the shared guard.\n   * @param _originChainId Origin chain id the voting power was deallocated from.\n   * @param _tokenId veNFT id whose voting power is being returned.\n   * @param _amount Voting power the leaf reports as deallocated; clamped on receipt.\n   */\n  function processDeallocation(uint256 _originChainId, uint256 _tokenId, uint128 _amount) external;\n\n  /**\n   * @notice Pull a token's booked voting power off a `Suspended` chain back to `CHAIN0`, without the leaf\n   *         confirmation that chain can no longer send, and ship the leaf a matching unwind.\n   * @dev Token owner or approved operator; `msg.value` funds the transport fee and excess is refunded. Reverts\n   *      `ChainNotSuspended`, `EmergencyDeallocationNotAllowed` (see `setEmergencyDeallocationAllowed`),\n   *      `NothingToDeallocate`, or `MissingDestinationGasLimit` on a zero `_gasLimit` for a non-root chain.\n   * @dev Full-drains at the stored shape through the same credit path as `processDeallocation`, so a later leaf\n   *      `deallocate` clamps to zero. The chain MUST NOT resume before the unwind lands — see `setChainStatus`.\n   *      A sunset chain keeps its normal exit paths; when its leaf or transport goes dark mid wind-down,\n   *      governance flips it to `Suspended` and this becomes the exit of last resort.\n   * @param _tokenId veNFT id whose voting power is being pulled back.\n   * @param _chainId Suspended chain id to pull the voting power from.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function emergencyDeallocate(\n    uint256 _tokenId,\n    uint256 _chainId,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Book a token's unbooked voting power (`staked - committed`) onto `CHAIN0`, where it earns nothing but\n   *         becomes available to chain allocations, VPM rebalances, `burn` and stake reshapes.\n   * @dev VotingEscrow only (`NotVotingEscrow`); it calls this on every deposit and on every shape change it does\n   *      not otherwise report, so the ledger mirrors the live stake. An expired stake reverts `StakeExpired`.\n   * @dev Anchors at the live `stakeEnd`, re-anchoring an older-shape position first, so it never reverts on a\n   *      stale shape. Leaves `lastAllocated` untouched, so parking never moves the cooldown anchor.\n   * @param _tokenId veNFT id whose unbooked voting power is parked.\n   */\n  function parkOnChain0(uint256 _tokenId) external;\n\n  /**\n   * @notice Drop a withdrawn token's root allocation ledger so a later revival starts from a clean slate.\n   * @dev VotingEscrow only (`NotVotingEscrow`), called from `withdraw` once the stake is zeroed. Clears\n   *      `tokenStates` and every `allocationChainAmounts` entry; `TOKEN0` reverts `Token0NotClearable`, and a\n   *      second call does nothing. A stale `lastStakeEnd` would revive the position at the wrong shape.\n   * @dev Deliberately touches no weight: the expired stake's bias already decayed to zero, so unwinding the\n   *      points would subtract twice and break `Σ per-chain == totalPoint`. No ceiling or scalar is resampled.\n   * @param _tokenId veNFT id being cleared.\n   */\n  function clearToken(uint256 _tokenId) external;\n\n  /**\n   * @notice Burn voting power parked on `TOKEN0` / `CHAIN0`.\n   * @dev `VOTING_ESCROW` only; it burns the matching accumulator stake and forwards the burn here.\n   * @param _amount AERO amount to burn from `tokenStates[TOKEN0].committed`.\n   */\n  function burn(uint128 _amount) external;\n\n  /**\n   * @notice Mirror a batch of `rebalanceUnderlying` moves onto the chain0 ledger.\n   * @dev `VOTING_ESCROW` only. Sources are drained and destinations credited independently: `rebalanceUnderlying`\n   *      conserves totals, so the per-tokenId net deltas hold however the equal totals are sliced, and a source\n   *      equal to a destination is allowed: its legs cancel out.\n   * @dev Settles chain0 and `totalPoint` once for the batch, then recomputes chain0's rate once. Stake-end\n   *      ordering is left to VotingEscrow; only `InsufficientChain0Allocation` and `DstShapeStale` are checked.\n   * @param _sources Source deltas drained from the chain0 ledger, as forwarded by VotingEscrow.\n   * @param _destinations Destination deltas credited to the chain0 ledger, mint sentinels already resolved.\n   */\n  function rebalanceChain0(\n    IVotingEscrow.SourceDelta[] calldata _sources,\n    IVotingEscrow.DestinationDelta[] calldata _destinations\n  ) external;\n\n  /**\n   * @notice Dispatch a cooldown reduction for `_tokenId` to a leaf.\n   * @dev Caller must pass `VOTING_ESCROW.isAuthorizedVPM`. `_reduction` must be non-zero, `_chainId` registered\n   *      and `Active` or `Sunset`, `_gasLimit` non-zero off the root chain; `msg.value` funds the transport fee.\n   *      Open under `Sunset` so a holder deep in cooldown can still land the exit vote before it expires.\n   * @dev Root stores nothing: the leaf accrues the reduction additively and spends it, clamped to its\n   *      `allocationCooldown`, on the next gauge allocation, so grants stack and message order does not matter.\n   * @param _tokenId veNFT id whose cooldown is being reduced.\n   * @param _chainId Destination chain the reduction applies to.\n   * @param _reduction Requested reduction in seconds, added to the leaf's pending reduction.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function reduceCooldown(\n    uint256 _tokenId,\n    uint256 _chainId,\n    uint48 _reduction,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Set the gauge-message lifetime stamped onto every gauge dispatch as an absolute expiry.\n   * @dev `VOTER_CONFIG_ROLE`. The leaf rejects an expired message with `AllocationExpired`, so a lifetime below\n   *      `MIN_MESSAGE_LIFETIME` reverts `AllocationLifetimeTooLow` here rather than expiring dispatches in transit.\n   *      A lifetime above `MAX_MESSAGE_LIFETIME` reverts `AllocationLifetimeTooHigh` so the stamped expiry can\n   *      never overflow uint48.\n   * @param _allocationLifetime New lifetime, in seconds.\n   */\n  function setAllocationLifetime(uint48 _allocationLifetime) external;\n\n  /**\n   * @notice Set the message lifetime stamped onto every claim and operator dispatch as an absolute expiry.\n   * @dev `VOTER_CONFIG_ROLE`. Bounds how long a dispatched claim or operator update stays executable on the leaf:\n   *      past the expiry the leaf drops it with `ExpiredMessageDropped`, so a stalled message cannot land after the\n   *      token changed hands on root. A lifetime below `MIN_MESSAGE_LIFETIME` reverts `MessageLifetimeTooLow` here\n   *      rather than expiring dispatches in transit. A lifetime above `MAX_MESSAGE_LIFETIME` reverts\n   *      `MessageLifetimeTooHigh` so the stamped expiry can never overflow uint48.\n   * @param _messageLifetime New lifetime, in seconds.\n   */\n  function setMessageLifetime(uint48 _messageLifetime) external;\n\n  /**\n   * @notice Register a new chain with the protocol.\n   * @dev `CHAIN_CONFIG_ROLE`. Seeds the chain's settlement cursors and sets `Active`. Reverts on `CHAIN0`, whose\n   *      state is fixed at construction, and on an already registered chain.\n   * @param _chainId Chain id to register.\n   */\n  function registerChain(uint256 _chainId) external;\n\n  /**\n   * @notice Update a registered chain's operational status.\n   * @dev `CHAIN_STATUS_ROLE`. Reverts on `CHAIN0`, unregistered chains, a `None` target and same-value writes;\n   *      `Suspended` only exits to `Active` or `Sunset`, `Sunset` only exits to `Suspended`, and entering\n   *      `Suspended` resets\n   *      `emergencyDeallocationAllowed` to `false`. Root and leaf are set independently:\n   *      suspend or sunset leaf first, resume root first, so the gap under-emits.\n   * @dev Before resuming from `Suspended`, governance MUST first switch\n   *      `setEmergencyDeallocationAllowed` off — an emergency\n   *      unwind created mid-checklist would invalidate every check below — and then confirm, in this order:\n   *      (1) every root->leaf message dispatched to the chain has landed or expired (`allocationLifetime` bounds\n   *      the gauge-vote wait) — a straggler landing after the resume can spawn a leaf `Deallocate` or reinstall\n   *      a stale pre-halt `emissionsPerVP`, while one landing before the resume is harmless;\n   *      (2) every leaf `Deallocate` the chain dispatched has been consumed by root — one consumed after a\n   *      resume-and-reallocate double-counts the power; (3) every `EmergencyDeallocate` sent during a\n   *      suspension reached the leaf — resuming early leaves the leaf budget under root.\n   * @dev Once the LEAF itself is back to `Active` (root resumes first), dispatch a zero-delta `allocateChains`\n   *      refresh poke: it restores the zeroed leaf scalar and its higher nonce outranks any straggler's rate.\n   *      Dispatched earlier, it lands masked to zero on the still-`Suspended` or still-`Sunset` leaf and spends\n   *      its nonce for nothing, leaving the chain under-emitting until another rate-bearing message arrives.\n   * @dev `Sunset` is expected to be terminal in practice; the transition out is an escape hatch. Reactivating\n   *      a sunset chain routes through `Suspended` on both sides, and the matrix enforces the first leg:\n   *      suspend the leaf (closes local `allocateGauges`, so it stops dispatching returns), suspend root\n   *      (stops dealloc dispatches, `allocateChains` already closed), reconcile leaf `Deallocated` against\n   *      root `DeallocationProcessed` until the in-flight set drains, then resume per the checklist above.\n   *      Direct `Sunset` -> `Active` would be unsafe: returns carry no expiry, so one dispatched before the\n   *      resume can land after a token re-allocates and be credited against the new booking, double-counting\n   *      that power. Suspending both sides first is what makes the in-flight set finite; waiting under\n   *      `Sunset` alone never closes it, because tokens keep dispatching new returns while you wait.\n   * @param _chainId Chain whose status is being updated.\n   * @param _status New status.\n   */\n  function setChainStatus(uint256 _chainId, ChainStatus _status) external;\n\n  /**\n   * @notice Enable or disable emergency deallocation for a registered chain.\n   * @dev `CHAIN_STATUS_ROLE`; reverts on an unregistered chain. Second gate on `emergencyDeallocate` next to the\n   *      `Suspended` requirement, and it resets to `false` on every suspend.\n   * @dev Enabling needs no drain: consuming a leaf `Deallocate` while `Suspended` is always safe, since the\n   *      clamp in `processDeallocation` meets a booking that cannot be refilled. Requiring a drain here would\n   *      also block emergencies indefinitely when the leaf->root path is down (returns carry no expiry). The\n   *      binding checklist sits on the resume instead — see `setChainStatus`.\n   * @param _chainId Chain whose switch is being set.\n   * @param _allowed `true` authorizes `emergencyDeallocate` for the current suspension.\n   */\n  function setEmergencyDeallocationAllowed(uint256 _chainId, bool _allowed) external;\n\n  /**\n   * @notice Set the per-tokenId operator for a chain and send the new value to the leaf.\n   * @dev `VOTING_ESCROW.isAuthorized(msg.sender, _tokenId)`. Reverts on `CHAIN0`, unregistered or `Paused`\n   *      chains, and a zero `_gasLimit` off the root chain. `Suspended` remains available so the owner can replace\n   *      or clear a stale operator, and `Sunset` so the operator running the local exit vote can still be rotated.\n   *      Always dispatches, so the leaf mirror stays in sync.\n   * @dev The message carries an absolute expiry of `block.timestamp + messageLifetime`; past it the leaf rejects the\n   *      update, so a stalled message cannot install an operator chosen before the token changed hands on root.\n   *      Known behavior: the leaf mirror still persists across root-side token transfers, so a new owner must\n   *      reset the operator on every leaf themselves.\n   * @param _tokenId Token whose operator is being set.\n   * @param _chainId Chain the operator applies to.\n   * @param _operator New operator address. Zero clears the slot.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function setOperator(\n    uint256 _tokenId,\n    uint256 _chainId,\n    address _operator,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Mint accumulated surplus that would otherwise never be distributed.\n   * @dev `GOVERNANCE_ROLE`. Surplus is entitlement that never minted, so leaving it alone keeps it deflationary\n   *      and remains the default. Each chain owns one pot netted against `surplusSpent`. For `CHAIN0` the pot is\n   *      its whole ceiling, since idle power settles a ceiling nothing ever redeems. For a registered chain it is\n   *      `reportedSurplus` clamped to the remaining mint entitlement `ceiling - totalRedeemed`, plus\n   *      `cumulativeSuspendedSurplus`, both dead to redeems. The clamp keeps buffer backed report excess out of\n   *      the pot until ceiling accrual covers it.\n   * @dev Settles the chain first, so a `Suspended` chain's pending accrual and `CHAIN0`'s lazily settled ceiling\n   *      growth are spendable in the same call. Works for any registered status including `Suspended`, which is\n   *      how governance recovers surplus stranded by a suspension.\n   * @dev Never reduces redeem headroom. `processRedeem` does not read `surplusSpent`, and the pots hold value no\n   *      receipt holder can claim. The minter adds the team share on top, same as redeems, and reverts\n   *      `AmountTooLow` below `MIN_MINT_AMOUNT`.\n   * @param _chainId Chain whose surplus pot is being spent. `CHAIN0` or a registered chain.\n   * @param _amount Amount of `TOKEN` to mint from the pot.\n   * @param _recipient Address that receives the minted `TOKEN`.\n   */\n  function spendSurplus(uint256 _chainId, uint256 _amount, address _recipient) external;\n\n  /*//////////////////////////////////////////////////////////////\n                                VARIABLES\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Reserved chainId for idle voting power: it settles and swaps into `totalPoint`, but never receives\n   *         a dispatch and never redeems its ceiling.\n   * @return _chain0 The reserved idle chainId.\n   */\n  function CHAIN0() external view returns (uint256 _chain0);\n\n  /**\n   * @notice Reserved tokenId of the permanent veNFT holding burned voting power, moved there via\n   *         `rebalanceChain0` before `burn`.\n   * @return _token0 The reserved sink tokenId.\n   */\n  function TOKEN0() external view returns (uint256 _token0);\n\n  /**\n   * @notice Root-side MessageOrchestrator the Voter dispatches batched allocations through.\n   * @return _orchestrator MessageOrchestrator contract.\n   */\n  function ORCHESTRATOR() external view returns (IRootMessageOrchestrator _orchestrator);\n\n  /**\n   * @notice Minter that issues `TOKEN` on redeem and supplies the emission rate. Set at deployment, immutable.\n   * @return _minter The bound minter.\n   */\n  function MINTER() external view returns (IMinter _minter);\n\n  /**\n   * @notice The emissions token, the same token `MINTER` mints. Donations are held and paid out in it.\n   * @return _token The emissions token.\n   */\n  function TOKEN() external view returns (IERC20 _token);\n\n  /**\n   * @notice VotingEscrow the Voter reads tokenId stakes from.\n   * @return _votingEscrow VotingEscrow contract.\n   */\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /**\n   * @notice Allocated AERO per `(tokenId, chainId)`; Σ across chains equals `tokenStates(tokenId).committed`.\n   * @param _tokenId veNFT id.\n   * @param _chainId Target chain identifier.\n   * @return _allocated AERO amount allocated to the chain.\n   */\n  function allocationChainAmounts(uint256 _tokenId, uint256 _chainId) external view returns (uint128 _allocated);\n\n  /**\n   * @notice Aggregate per-chain state (point, ceiling, redeem accumulators, packed small fields).\n   * @param _chainId Target chain identifier.\n   * @return _point Aggregate voting power for the chain.\n   * @return _ceiling Cumulative emissions the chain may claim.\n   * @return _totalRedeemed Total `TOKEN` minted for the chain via redeem.\n   * @return _reportedSurplus High-water mark of unused-emissions surplus reported to root for the chain.\n   * @return _cumulativeSuspendedSurplus Would-be ceiling growth caught while the chain was `Suspended`.\n   * @return _surplusSpent Cumulative surplus minted for the chain via `spendSurplus`.\n   * @return _lastIndex The chain's cursor into the global `index` at its last ceiling settlement.\n   * @return _lastTimeIndex The chain's cursor into the global `timeIndex` at its last ceiling settlement.\n   * @return _donatedBuffer Donated `TOKEN` held for the chain's redeems, drawn once its ceiling is exhausted.\n   * @return _status Operational status of the chain.\n   */\n  function chainStates(uint256 _chainId)\n    external\n    view\n    returns (\n      Point memory _point,\n      uint256 _ceiling,\n      uint256 _totalRedeemed,\n      uint256 _reportedSurplus,\n      uint256 _cumulativeSuspendedSurplus,\n      uint256 _surplusSpent,\n      uint256 _lastIndex,\n      uint256 _lastTimeIndex,\n      uint256 _donatedBuffer,\n      ChainStatus _status\n    );\n\n  /**\n   * @notice Scheduled slope reduction at a stake expiry for a chain.\n   * @param _chainId Target chain identifier.\n   * @param _expiry Expiry timestamp.\n   * @return _slopeChange Slope reduction scheduled at `_expiry`.\n   */\n  function chainSlopeChanges(uint256 _chainId, uint48 _expiry) external view returns (int128 _slopeChange);\n\n  /**\n   * @notice Gauge-message lifetime stamped onto every gauge dispatch as an absolute expiry.\n   * @return _allocationLifetime Lifetime, in seconds.\n   */\n  function allocationLifetime() external view returns (uint48 _allocationLifetime);\n\n  /**\n   * @notice Claim and operator message lifetime stamped onto every claim and operator dispatch as an absolute expiry.\n   * @return _messageLifetime Lifetime, in seconds.\n   */\n  function messageLifetime() external view returns (uint48 _messageLifetime);\n\n  /**\n   * @notice Donated `TOKEN` held for a chain's redeems, drawn once the chain's ceiling is exhausted.\n   * @dev Convenience view over `chainStates`. Tracked next to the ceiling, never credited into it, so the\n   *      ceiling keeps tracking the minter schedule and donated headroom stays auditable on its own.\n   * @param _chainId Chain whose donated buffer is being read.\n   * @return _amount `TOKEN` available to the chain's redeems beyond its ceiling.\n   */\n  function donatedBuffer(uint256 _chainId) external view returns (uint256 _amount);\n\n  /**\n   * @notice Aggregate voting power across all chains.\n   * @return _bias Current voting power.\n   * @return _slope Rate of decay per second.\n   * @return _ts Timestamp of last resolution.\n   * @return _permanentStakeBalance Non-decaying voting power from permanent stakes.\n   */\n  function totalPoint() external view returns (int128 _bias, int128 _slope, uint48 _ts, uint128 _permanentStakeBalance);\n\n  /**\n   * @notice Global emissions accumulator: the running integral of `emissionsPerVP` over time. Every chain's\n   *         ceiling accrues off it, paired with `timeIndex` (see `ChainState`).\n   * @return _index Current accumulator value, `PRECISION`-scaled.\n   */\n  function index() external view returns (uint256 _index);\n\n  /**\n   * @notice Global time-weighted emissions accumulator: `emissionsPerVP` integrated against absolute (unix-epoch)\n   *         time, stored doubled. Paired with `index` it prices a decaying chain's ceiling exactly across a\n   *         scalar change.\n   * @return _timeIndex Current time-weighted accumulator value, doubled and `PRECISION`-scaled.\n   */\n  function timeIndex() external view returns (uint256 _timeIndex);\n\n  /**\n   * @notice Global emissions per unit voting power since the last touch, `PRECISION`-scaled\n   *         (`emissionRate * PRECISION / totalWeight`). Drives the `index` advance and is shipped to leaves.\n   * @return _emissionsPerVP The current scalar.\n   */\n  function emissionsPerVP() external view returns (uint256 _emissionsPerVP);\n\n  /**\n   * @notice Value of `index` at each week boundary the global settle has crossed.\n   * @dev Chain ceilings accrue one segment per boundary, so root partitions time exactly like the leaf's gauge\n   *      walk. A chain touched more often than its gauges are settled would otherwise accrue less than the leaf\n   *      credits, and the difference is unredeemable.\n   * @param _boundary Week-aligned timestamp.\n   * @return _index Accumulator value recorded at that boundary.\n   */\n  function indexAtBoundary(uint48 _boundary) external view returns (uint256 _index);\n\n  /**\n   * @notice Value of `timeIndex` at each week boundary the global settle has crossed.\n   * @param _boundary Week-aligned timestamp.\n   * @return _timeIndex Time-weighted accumulator value recorded at that boundary.\n   */\n  function timeIndexAtBoundary(uint48 _boundary) external view returns (uint256 _timeIndex);\n\n  /**\n   * @notice Timestamp the global accumulators were last advanced to.\n   * @return _lastGlobalSettlement The settle cursor.\n   */\n  function lastGlobalSettlement() external view returns (uint48 _lastGlobalSettlement);\n\n  /**\n   * @notice Scheduled slope reduction at a stake expiry, aggregated across chains.\n   * @param _expiry Expiry timestamp.\n   * @return _slopeChange Slope reduction scheduled at `_expiry`.\n   */\n  function totalSlopeChanges(uint48 _expiry) external view returns (int128 _slopeChange);\n\n  /*//////////////////////////////////////////////////////////////\n                                  VIEWS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Whether the route from a given chain is currently suspended. Read by\n   *         `RootMessageOrchestrator.route` before it hands an inbound payload to a typed handler.\n   * @dev Strictly `Suspended`: a `Sunset` chain returns false, since its exits stay open. Off-chain monitors\n   *      tracking a wind-down must read the chain status instead of this flag.\n   * @param _chainId Source chain id to check.\n   * @return _isSuspended Whether the route from `_chainId` is suspended.\n   */\n  function isSuspended(uint256 _chainId) external view returns (bool _isSuspended);\n\n  /**\n   * @notice Surplus currently spendable for a chain via `spendSurplus`.\n   * @dev Computed from stored values, so it is a floor rather than a quote. `CHAIN0`'s ceiling and a `Suspended`\n   *      chain's accrual lag until their next settle, and `spendSurplus` settles before checking, so the\n   *      executable amount is at least this value.\n   * @dev A registered chain's reported surplus counts only up to the remaining mint entitlement\n   *      `ceiling - totalRedeemed`. Report excess accepted against the donated buffer stays out of the pot, so\n   *      the same donated backing cannot pay a redeem and fund a surplus mint.\n   * @param _chainId Chain whose spendable surplus is being read.\n   * @return _spendable Spendable surplus for the chain.\n   */\n  function spendableSurplus(uint256 _chainId) external view returns (uint256 _spendable);\n\n  /**\n   * @notice Whether emergency deallocation is currently authorized for a chain.\n   * @dev Second gate on `emergencyDeallocate`; reset to `false` on every suspend.\n   * @param _chainId Chain to check.\n   * @return _allowed Whether `emergencyDeallocate` is authorized for `_chainId`.\n   */\n  function emergencyDeallocationAllowed(uint256 _chainId) external view returns (bool _allowed);\n\n  /**\n   * @notice Chains the tokenId currently holds a non-zero allocation on, in storage order.\n   * @dev `CHAIN0` may be present alongside cross-chain allocations.\n   * @param _tokenId veNFT id.\n   * @return _chainIds Chain ids the tokenId has allocated on.\n   */\n  function allocationChainIds(uint256 _tokenId) external view returns (uint256[] memory _chainIds);\n\n  /**\n   * @notice Chains registered via `registerChain`, in storage order. `CHAIN0` is never present.\n   * @return _chainIds Registered chain ids.\n   */\n  function chains() external view returns (uint256[] memory _chainIds);\n\n  /**\n   * @notice Whether the tokenId directs any voting power to a non-CHAIN0 chain.\n   * @param _tokenId veNFT id.\n   * @return _isAllocating True when the tokenId has non-CHAIN0 allocation.\n   */\n  function allocating(uint256 _tokenId) external view returns (bool _isAllocating);\n\n  /**\n   * @notice Per-tokenId voting record captured on the last allocation.\n   * @dev `lastStakeEnd` and `isPermanent` are anchored on every chain0 destination leg and park, seeded for a\n   *      first-time recipient, so they can be set while `lastAllocated` is still zero. Source legs read the\n   *      stored shape and never write it. `lastAllocated` moves only on a chain allocation. `TOKEN0` is seeded\n   *      permanent at deployment, mirroring the escrow accumulator.\n   * @param _tokenId veNFT id.\n   * @return _committed Committed size.\n   * @return _lastStakeEnd Stake end captured at the last allocation.\n   * @return _lastAllocated Timestamp of the last allocation.\n   * @return _isPermanent True when the stored shape is permanent.\n   */\n  function tokenStates(uint256 _tokenId)\n    external\n    view\n    returns (uint128 _committed, uint48 _lastStakeEnd, uint48 _lastAllocated, bool _isPermanent);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n    /*\n     * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n     * 0xb0202a11 ===\n     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n     */\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @param data Additional data with no specified format, sent in call to `spender`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n"},"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},"V3/src/metarouter/libraries/ClResolverLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {INonfungiblePositionManager} from 'V3/interfaces/external/INonfungiblePositionManager.sol';\nimport {ICLFactory} from 'V3/interfaces/factories/ICLFactory.sol';\nimport {ICLGaugeFactory} from 'V3/interfaces/factories/ICLGaugeFactory.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title ClResolverLib\n * @notice Resolves the position manager a CL command operates through, from the factory that owns the position's\n *         collection.\n * @dev Internal helpers inlined into the command libraries, so the router holds no canonical position manager and a\n *      second approved CL factory can be added without redeploying it. Each factory names one immutable manager and\n *      each manager names one immutable factory, so the pair authenticates itself: requiring the manager to point back\n *      leaves a factory unable to nominate another factory's collection. A factory deployed before the manager getter\n *      existed cannot name its manager itself; the gauge factory the registry pairs it with binds the same manager\n *      through its own immutable, so the resolver falls back to that record when the getter fails and the reverse\n *      link authenticates the pair all the same. What establishes the factory itself differs per entry point. A\n *      factory named in calldata must be approved or have a permanent factory-pair record in the registry. That\n *      record survives deregistration, so existing positions remain usable. A factory reached through a gauge is\n *      already fixed by write-once registry records, so that path reads the records alone.\n */\nlibrary ClResolverLib {\n  /**\n   * @notice Resolves and authenticates the position manager of a known CL factory, including a retired one.\n   * @dev Current approval admits factories before gauge pairing. The permanent pair record also authenticates a\n   *      factory after deregistration. Both are checked before calling the factory; a caller-supplied address alone\n   *      cannot cross the registry boundary. Pool creation must separately require current approval.\n   * @param _poolFactory Pool factory naming the collection the command operates on.\n   * @param _factoryRegistry Registry holding the router's factory trust boundary.\n   * @return _positionManager Authenticated position manager of `_poolFactory`.\n   */\n  function resolvePositionManager(\n    address _poolFactory,\n    IFactoryRegistry _factoryRegistry\n  ) internal view returns (INonfungiblePositionManager _positionManager) {\n    if (\n      !_factoryRegistry.isTargetFactoryApproved(_poolFactory)\n        && _factoryRegistry.targetFactoryToGaugeFactory(_poolFactory) == address(0)\n    ) {\n      revert IMetarouter.FactoryNotApproved();\n    }\n    _positionManager = _authenticatePositionManager(_poolFactory, _factoryRegistry);\n  }\n\n  /**\n   * @notice Resolves and authenticates the position manager paired with a gauge factory.\n   * @dev `GaugeLib` first proves this is the factory permanently recorded for the gauge, and the target factory it\n   *      links to is recorded write-once as well. Both records outlive `unregisterFactories`, so they anchor the\n   *      factory's identity on their own and this path takes no approval check. A caller never names either factory,\n   *      which leaves nothing for the approval set to authenticate here, and unregistering a live CL factory\n   *      therefore does not strand staked positions behind the router.\n   * @param _gaugeFactory Registry-authenticated gauge factory serving the position collection.\n   * @param _factoryRegistry Registry holding the gauge, target, and factory records.\n   * @return _positionManager Authenticated position manager of the gauge factory's linked target factory.\n   */\n  function resolveGaugePositionManager(\n    address _gaugeFactory,\n    IFactoryRegistry _factoryRegistry\n  ) internal view returns (INonfungiblePositionManager _positionManager) {\n    _positionManager = _authenticatePositionManager(\n      _factoryRegistry.gaugeFactoryToTargetFactory(_gaugeFactory), _factoryRegistry\n    );\n  }\n\n  /**\n   * @notice Resolves a CL factory's position manager and requires it to name that factory back.\n   * @dev The factory's own getter is the canonical source. A factory deployed before that getter existed reverts on\n   *      it, so the resolver then reads the manager bound by the gauge factory the registry pairs with the factory.\n   *      That pair record is write-once and the gauge factory's manager is immutable, so the fallback adds no mutable\n   *      trust, and the reverse link below still refuses a manager of another factory. A factory with neither source\n   *      names no manager at all.\n   * @param _poolFactory Pool factory whose canonical manager is resolved.\n   * @param _factoryRegistry Registry holding the factory-pair record the fallback reads.\n   * @return _positionManager Authenticated position manager of `_poolFactory`.\n   */\n  function _authenticatePositionManager(\n    address _poolFactory,\n    IFactoryRegistry _factoryRegistry\n  ) private view returns (INonfungiblePositionManager _positionManager) {\n    try ICLFactory(_poolFactory).positionManager() returns (address _namedPositionManager) {\n      _positionManager = INonfungiblePositionManager(_namedPositionManager);\n    } catch {\n      address _gaugeFactory = _factoryRegistry.targetFactoryToGaugeFactory(_poolFactory);\n      if (_gaugeFactory == address(0)) revert IMetarouter.PositionManagerNotConfigured(_poolFactory);\n      _positionManager = INonfungiblePositionManager(ICLGaugeFactory(_gaugeFactory).nft());\n    }\n    if (address(_positionManager) == address(0)) revert IMetarouter.PositionManagerNotConfigured(_poolFactory);\n\n    if (_positionManager.factory() != _poolFactory) {\n      revert IMetarouter.PositionManagerFactoryMismatch(_poolFactory, address(_positionManager));\n    }\n  }\n}\n"},"V3/src/interfaces/external/INonfungiblePositionManager.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\n\n/**\n * @title INonfungiblePositionManager\n * @notice Minimal view of the concentrated-liquidity `NonfungiblePositionManager` used by the Metarouter's CL position\n *         commands: the ERC721 custody surface plus mint, liquidity changes, fee collection, burn, and the position\n *         read the handlers need to resolve a position's tokens.\n * @dev The upstream manager ships in the `metadex-slipstream` repo, which is not remapped into this repo, so the\n *      selectors and structs the commands call are mirrored here as one self-contained interface. It inherits `IERC721`\n *      because the manager is an ERC721 and the router uses its custody calls (`ownerOf`, `approve`, `transferFrom`,\n *      `safeTransferFrom`) alongside the position calls. Struct field names and the `positions` tuple are kept verbatim\n *      so they match the manager's ABI.\n */\ninterface INonfungiblePositionManager is IERC721 {\n  /**\n   * @notice Arguments for `mint`.\n   * @param token0 First pool token, sorted ascending.\n   * @param token1 Second pool token, sorted ascending.\n   * @param tickSpacing Tick spacing identifying the pool alongside its tokens.\n   * @param tickLower Lower tick of the position range.\n   * @param tickUpper Upper tick of the position range.\n   * @param amount0Desired Maximum `token0` to contribute.\n   * @param amount1Desired Maximum `token1` to contribute.\n   * @param amount0Min Minimum `token0` to contribute, as a slippage bound.\n   * @param amount1Min Minimum `token1` to contribute, as a slippage bound.\n   * @param recipient Address the minted position is transferred to.\n   * @param deadline Timestamp after which the mint reverts.\n   * @param sqrtPriceX96 Price to initialize the pool with when it does not yet exist; ignored when zero.\n   */\n  struct MintParams {\n    address token0;\n    address token1;\n    int24 tickSpacing;\n    int24 tickLower;\n    int24 tickUpper;\n    uint256 amount0Desired;\n    uint256 amount1Desired;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    address recipient;\n    uint256 deadline;\n    uint160 sqrtPriceX96;\n  }\n\n  /**\n   * @notice Arguments for `increaseLiquidity`.\n   * @param tokenId Position to add liquidity to.\n   * @param amount0Desired Maximum `token0` to contribute.\n   * @param amount1Desired Maximum `token1` to contribute.\n   * @param amount0Min Minimum `token0` to contribute, as a slippage bound.\n   * @param amount1Min Minimum `token1` to contribute, as a slippage bound.\n   * @param deadline Timestamp after which the increase reverts.\n   */\n  struct IncreaseLiquidityParams {\n    uint256 tokenId;\n    uint256 amount0Desired;\n    uint256 amount1Desired;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Arguments for `decreaseLiquidity`.\n   * @param tokenId Position to remove liquidity from.\n   * @param liquidity Liquidity to remove, accounted to the position's owed tokens.\n   * @param amount0Min Minimum `token0` accounted, as a slippage bound.\n   * @param amount1Min Minimum `token1` accounted, as a slippage bound.\n   * @param deadline Timestamp after which the decrease reverts.\n   */\n  struct DecreaseLiquidityParams {\n    uint256 tokenId;\n    uint128 liquidity;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Arguments for `collect`.\n   * @param tokenId Position whose owed tokens are collected.\n   * @param recipient Address receiving the collected tokens.\n   * @param amount0Max Maximum `token0` to collect.\n   * @param amount1Max Maximum `token1` to collect.\n   */\n  struct CollectParams {\n    uint256 tokenId;\n    address recipient;\n    uint128 amount0Max;\n    uint128 amount1Max;\n  }\n\n  /**\n   * @notice Creates a new position wrapped in an NFT.\n   * @param params Mint arguments encoded as `MintParams`.\n   * @return tokenId Id of the minted position.\n   * @return liquidity Liquidity of the minted position.\n   * @return amount0 `token0` contributed.\n   * @return amount1 `token1` contributed.\n   */\n  function mint(MintParams calldata params)\n    external\n    payable\n    returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Adds liquidity to an existing position, paid by the caller.\n   * @param params Increase arguments encoded as `IncreaseLiquidityParams`.\n   * @return liquidity Liquidity added to the position.\n   * @return amount0 `token0` contributed.\n   * @return amount1 `token1` contributed.\n   */\n  function increaseLiquidity(IncreaseLiquidityParams calldata params)\n    external\n    payable\n    returns (uint128 liquidity, uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Removes liquidity from a position, accounting it to the position's owed tokens.\n   * @param params Decrease arguments encoded as `DecreaseLiquidityParams`.\n   * @return amount0 `token0` accounted to the position's owed tokens.\n   * @return amount1 `token1` accounted to the position's owed tokens.\n   */\n  function decreaseLiquidity(DecreaseLiquidityParams calldata params)\n    external\n    payable\n    returns (uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Collects owed tokens from a position to the recipient.\n   * @param params Collect arguments encoded as `CollectParams`.\n   * @return amount0 `token0` collected.\n   * @return amount1 `token1` collected.\n   */\n  function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Burns a position, which must hold no liquidity and no owed tokens.\n   * @param tokenId Position to burn.\n   */\n  function burn(uint256 tokenId) external payable;\n\n  /**\n   * @notice Returns the position associated with a token id.\n   * @param tokenId Position to read.\n   * @return nonce Permit nonce.\n   * @return operator Approved operator for the position.\n   * @return token0 First pool token.\n   * @return token1 Second pool token.\n   * @return tickSpacing Tick spacing of the pool.\n   * @return tickLower Lower tick of the position range.\n   * @return tickUpper Upper tick of the position range.\n   * @return liquidity Liquidity held by the position.\n   * @return feeGrowthInside0LastX128 `token0` fee growth snapshot at the last position action.\n   * @return feeGrowthInside1LastX128 `token1` fee growth snapshot at the last position action.\n   * @return tokensOwed0 Uncollected `token0` owed to the position.\n   * @return tokensOwed1 Uncollected `token1` owed to the position.\n   */\n  function positions(uint256 tokenId)\n    external\n    view\n    returns (\n      uint96 nonce,\n      address operator,\n      address token0,\n      address token1,\n      int24 tickSpacing,\n      int24 tickLower,\n      int24 tickUpper,\n      uint128 liquidity,\n      uint256 feeGrowthInside0LastX128,\n      uint256 feeGrowthInside1LastX128,\n      uint128 tokensOwed0,\n      uint128 tokensOwed1\n    );\n\n  /**\n   * @notice Returns the CL factory whose pools this manager issues positions for.\n   * @dev Immutable upstream, and the reverse of `ICLFactory.positionManager`; the router authenticates a resolved\n   *      manager by requiring this to point back at the factory it came from.\n   * @return The concentrated-liquidity factory.\n   */\n  function factory() external view returns (address);\n}\n"},"V3/src/metarouter/libraries/GaugeLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {ZERO_GAUGE} from 'V3/libraries/ProtocolConstants.sol';\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IGaugeFactory} from 'V3/interfaces/factories/IGaugeFactory.sol';\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\nimport {IV2Gauge} from 'V3/interfaces/gauges/IV2Gauge.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title GaugeLib\n * @notice Shared gauge introspection helpers for the Metarouter command libraries.\n * @dev Internal-only library: the helpers inline into each command library that uses them, so sharing them adds no\n *      linking or `DELEGATECALL` surface.\n */\nlibrary GaugeLib {\n  /// @notice Keccak hash of `'cl'`, the `GAUGE_TYPE()` string a concentrated-liquidity gauge factory reports.\n  bytes32 private constant _CL_GAUGE_TYPE_HASH = keccak256('cl');\n\n  /**\n   * @notice Reverts unless the gauge is a routable target registered with the Voter.\n   * @dev The Voter registers `ZERO_GAUGE` as the idle sink a vote parks power on, so registration alone does not make\n   *      a target routable. It is a bookkeeping key rather than a contract, and it is excluded here the way\n   *      `LeafVoter.activateGauge` excludes it.\n   * @param _gauge Gauge target to validate.\n   * @param _leafVoter Leaf Voter whose `gaugeStates` gates the target.\n   */\n  function requireRegisteredGauge(address _gauge, ILeafVoter _leafVoter) internal view {\n    if (_gauge == ZERO_GAUGE) revert IMetarouter.GaugeNotRegistered();\n    // slither-disable-next-line unused-return\n    (,,, bool _isRegistered,,,,,) = _leafVoter.gaugeStates(_gauge);\n    if (!_isRegistered) revert IMetarouter.GaugeNotRegistered();\n  }\n\n  /**\n   * @notice Returns whether a validated gauge is a concentrated-liquidity gauge, along with its factory.\n   * @dev Classifies through the factory permanently recorded for the gauge, after requiring the gauge's immutable\n   *      self-report to agree with that record. This gives venue classification and every downstream registry lookup\n   *      the same trust root. A CL factory reports `cl`; any other value takes the V2 path. A validated gauge always\n   *      carries a record, because `GaugeManager.createGauge` writes it in the same transaction that registers the\n   *      gauge with the Voter, so agreement is the only thing left to check.\n   * @param _gauge Validated gauge whose venue is resolved.\n   * @param _factoryRegistry Registry holding the gauge's permanent deploying-factory record.\n   * @return _isCl Whether the gauge stakes CL positions.\n   * @return _gaugeFactory Factory the gauge reports as its deployer.\n   */\n  function isClGauge(\n    address _gauge,\n    IFactoryRegistry _factoryRegistry\n  ) internal view returns (bool _isCl, IGaugeFactory _gaugeFactory) {\n    address _recordedFactory = _factoryRegistry.gaugeToFactory(_gauge);\n    address _reportedFactory = IGauge(_gauge).gaugeFactory();\n    if (_reportedFactory != _recordedFactory) {\n      revert IMetarouter.GaugeFactoryMismatch(_gauge, _recordedFactory, _reportedFactory);\n    }\n    _gaugeFactory = IGaugeFactory(_recordedFactory);\n    _isCl = keccak256(bytes(_gaugeFactory.GAUGE_TYPE())) == _CL_GAUGE_TYPE_HASH;\n  }\n\n  /**\n   * @notice Reverts when a V2 gauge's early-unstake penalty is live and the logical sender did not accept it.\n   * @dev Uses the gauge's penalty-window view, which shares the condition used when slashing emissions the account has\n   *      accrued on a V2 gauge. Routed messages carry no ordering guarantees, so a relayer could land a stale\n   *      deposit right before a withdrawal or claim and forfeit the account's full accrual; the explicit flag keeps\n   *      that outcome a decision of the logical sender. The gate checks only that the window is live, not whether\n   *      anything would actually be slashed: the gauge exposes no pre-penalty accrual view. So an exit with zero\n   *      accrued rewards inside the window also needs the flag, which is harmless to accept in that case.\n   * @param _gauge V2 gauge whose live penalty state is checked.\n   * @param _account Logical sender whose deposit timer controls the penalty.\n   * @param _allowPenalty Whether the logical sender explicitly accepts an active penalty.\n   */\n  function requirePenaltyAllowed(address _gauge, address _account, bool _allowPenalty) internal view {\n    if (_allowPenalty) return;\n\n    if (IV2Gauge(_gauge).isPenaltyActive({_account: _account})) revert IMetarouter.PenaltyNotAccepted();\n  }\n}\n"},"V3/src/metarouter/libraries/V2PoolLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IPoolFactory} from 'V3/interfaces/factories/IPoolFactory.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\n\n/**\n * @title V2PoolLib\n * @notice Authenticates existing V2 pools independently of current factory approval.\n */\nlibrary V2PoolLib {\n  /// @notice Pool family reported by stable V2 pools.\n  bytes32 private constant _V2_STABLE_POOL_TYPE = 'V2_STABLE';\n  /// @notice Pool family reported by volatile V2 pools.\n  bytes32 private constant _V2_VOLATILE_POOL_TYPE = 'V2_VOLATILE';\n\n  /**\n   * @notice Validates a recorded V2 pool and returns its deploying factory.\n   * @dev Factory retirement prevents creation, but does not invalidate existing pools. Match swap validation by\n   *      checking the permanent creation record, factory membership, and supported pool family.\n   * @param _pool Pool target to authenticate.\n   * @param _factoryRegistry Registry holding the permanent creation record.\n   * @return _factory Recorded deploying factory.\n   */\n  function validatePool(address _pool, IFactoryRegistry _factoryRegistry) internal view returns (address _factory) {\n    _factory = _factoryRegistry.targetToFactory(_pool);\n    if (_factory == address(0)) revert IMetarouter.PoolNotRegistered();\n    if (!IPoolFactory(_factory).isPool(_pool)) revert IMetarouter.InvalidPool(_pool);\n    bytes32 _poolType = IPool(_pool).POOL_TYPE();\n    if (_poolType != _V2_VOLATILE_POOL_TYPE && _poolType != _V2_STABLE_POOL_TYPE) {\n      revert IMetarouter.InvalidPool(_pool);\n    }\n  }\n}\n"},"V3/src/interfaces/gauges/ICLGauge.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title ICLGauge\n * @notice Minimal concentrated-liquidity gauge surface consumed by the Metarouter staking and claim commands.\n * @dev Minimal ABI-compatible slice of the Solidity 0.7.6 `ICLGauge` interface maintained in `metadex-slipstream`.\n */\ninterface ICLGauge {\n  /**\n   * @notice Claims emissions for selected positions belonging to an account.\n   * @param _account Account whose position emissions are claimed.\n   * @param _recipient Address receiving the emissions.\n   * @param _tokenIds Positions to claim, bounding the gauge's iteration to this caller-selected set.\n   */\n  function claimEmissions(address _account, address _recipient, uint256[] calldata _tokenIds) external;\n\n  /**\n   * @notice First token of the pool the gauge incentivizes.\n   * @return _token0 The pool's `token0`.\n   */\n  function token0() external view returns (address _token0);\n\n  /**\n   * @notice Second token of the pool the gauge incentivizes.\n   * @return _token1 The pool's `token1`.\n   */\n  function token1() external view returns (address _token1);\n}\n"},"V3/src/interfaces/gauges/IGauge.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IGauge {\n  /**\n   * @notice Emitted when the gauge collects pool fees through the VotingRewardsManager.\n   * @param _caller The address that triggered fee collection.\n   * @param _claimed0 The amount of token0 fees collected.\n   * @param _claimed1 The amount of token1 fees collected.\n   */\n  event ClaimFees(address indexed _caller, uint256 _claimed0, uint256 _claimed1);\n\n  /**\n   * @notice Emitted when an account grants or revokes claim approval for an operator\n   * @param _account The account whose approval state changed\n   * @param _operator The operator being approved or revoked\n   * @param _approved The new approval state\n   */\n  event ClaimApproval(address indexed _account, address indexed _operator, bool _approved);\n\n  /**\n   * @notice Emitted when an owner grants or revokes blanket withdrawal approval for an operator\n   * @param _owner The owner whose approval changed\n   * @param _operator The operator being approved or revoked\n   * @param _approved The new approval state\n   */\n  event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n\n  /**\n   * @notice Emitted when a referral's deferred emissions are claimed.\n   * @param _referral The referral address whose deferred emissions were claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   * @param _amount The deferred referral emissions paid to the recipient.\n   */\n  event ReferralEmissionsClaimed(address indexed _referral, address indexed _recipient, uint256 _amount);\n\n  /**\n   * @notice Thrown when the caller is neither the account nor an approved operator.\n   */\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a caller other than the VotingRewardsManager attempts to collect fees.\n   */\n  error NotVotingRewardsManager();\n\n  /**\n   * @notice Thrown when a zero address is supplied where a non-zero address is required.\n   */\n  error ZeroAddress();\n\n  /**\n   * @notice Deposit a staked position\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   */\n  function deposit(uint256 _lp) external;\n\n  /**\n   * @notice Deposit a staked position on behalf of an owner\n   * @dev For V2 gauges, approved MetaRouters are trusted to restrict `_owner` to the account that authorized the\n   *      routed deposit; otherwise, they could reset another account's early-unstake penalty timer.\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   * @param _owner The address credited as the staked owner\n   */\n  function depositFor(uint256 _lp, address _owner) external;\n\n  /**\n   * @notice Withdraw a staked position owned by the caller\n   * @dev Defers accrued emissions when emission minting reverts\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   */\n  function withdraw(uint256 _lp) external;\n\n  /**\n   * @notice Withdraw a staked position on behalf of an account\n   * @dev Defers accrued emissions when emission minting reverts\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   * @param _account The position owner\n   */\n  function withdrawFrom(uint256 _lp, address _account) external;\n\n  /**\n   * @notice Claim accrued and deferred emissions\n   * @dev Requires the caller to be the LP or an operator with claim approval\n   * @param _account The address of the LP staker whose emissions are being claimed\n   * @param _recipient The recipient of the claimed emissions\n   */\n  function claimEmissions(address _account, address _recipient) external;\n\n  /**\n   * @notice Claims a referral's deferred emissions.\n   * @dev Requires the caller to be the referral or an operator with claim approval.\n   * @param _referral The referral address whose deferred emissions are being claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   */\n  function claimReferralEmissions(address _referral, address _recipient) external;\n\n  /**\n   * @notice Grant or revoke an operator's approval to claim emissions on behalf of the caller\n   * @param _operator The operator to approve or revoke\n   * @param _approved True to approve, false to revoke\n   */\n  function approveForClaim(address _operator, bool _approved) external;\n\n  /**\n   * @notice Grant or revoke blanket withdrawal authorization for an operator over all staked positions\n   * @param _operator The operator to authorize or revoke\n   * @param _approved True to grant blanket approval, false to revoke\n   */\n  function setApprovalForAll(address _operator, bool _approved) external;\n\n  /**\n   * @notice Approve an operator to withdraw a staked position\n   * @param _operator The operator to authorize\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   */\n  function approve(address _operator, uint256 _lp) external;\n\n  /**\n   * @notice Collect currently claimable pool fees directly to the VotingRewardsManager.\n   * @dev Only callable by the VotingRewardsManager.\n   * @return _amount0 The token0 fees collected.\n   * @return _amount1 The token1 fees collected.\n   */\n  function collectFees() external returns (uint256 _amount0, uint256 _amount1);\n\n  /**\n   * @notice LeafVoter contract used for gauge settlement.\n   * @return The address of the LeafVoter.\n   */\n  function voter() external view returns (address);\n\n  /**\n   * @notice Address of the factory that created this gauge.\n   * @return The address of the gauge factory.\n   */\n  function gaugeFactory() external view returns (address);\n\n  /**\n   * @notice Address of the VotingRewardsManager contract linked to the gauge.\n   * @return The address of the VotingRewardsManager.\n   */\n  function votingRewardsManager() external view returns (address);\n\n  /**\n   * @notice Returns if gauge is linked to a legitimate pool.\n   * @return Whether the gauge is linked to a legitimate pool.\n   */\n  function isPool() external view returns (bool);\n\n  /**\n   * @notice The gauge's cursor into the LeafVoter's cumulative reward share accumulator\n   * @return The cumulative reward share at the gauge's last settlement\n   */\n  function lastCumulativeRewardShare() external view returns (uint256);\n\n  /**\n   * @notice Estimates the accrued and deferred emissions claimable by an account\n   * @dev Rewards accrued since the last settlement are an estimate\n   * @param _account The address of the LP staker\n   * @return The estimated claimable amount\n   */\n  function earned(address _account) external view returns (uint256);\n\n  /**\n   * @notice Whether an operator is approved to claim emissions on behalf of an account\n   * @param _account The account that granted the approval\n   * @param _operator The operator being queried\n   * @return True if the operator is approved\n   */\n  function approvedForClaim(address _account, address _operator) external view returns (bool);\n\n  /**\n   * @notice Deferred referral emissions stored for a referral.\n   * @param _referral The referral credited with the deferred emissions.\n   * @return The referral's deferred emissions.\n   */\n  function deferredReferralEmissions(address _referral) external view returns (uint256);\n\n  /**\n   * @notice Returns whether an operator has blanket withdrawal authorization for an owner's positions\n   * @param _owner The staked position owner\n   * @param _operator The candidate operator\n   * @return True if blanket approval is active\n   */\n  function isApprovedForAll(address _owner, address _operator) external view returns (bool);\n\n  /**\n   * @notice Return currently claimable pool fees without moving tokens or mutating state.\n   * @return _amount0 The currently pending token0 fees.\n   * @return _amount1 The currently pending token1 fees.\n   */\n  function pendingFees() external view returns (uint256 _amount0, uint256 _amount1);\n}\n"},"node_modules/@openzeppelin/contracts/utils/math/Math.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Return the 512-bit addition of two uint256.\n     *\n     * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n     */\n    function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        assembly (\"memory-safe\") {\n            low := add(a, b)\n            high := lt(low, a)\n        }\n    }\n\n    /**\n     * @dev Return the 512-bit multiplication of two uint256.\n     *\n     * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n     */\n    function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n        // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n        // variables such that product = high * 2²⁵⁶ + low.\n        assembly (\"memory-safe\") {\n            let mm := mulmod(a, b, not(0))\n            low := mul(a, b)\n            high := sub(sub(mm, low), lt(mm, low))\n        }\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a + b;\n            success = c >= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a - b;\n            success = c <= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a * b;\n            assembly (\"memory-safe\") {\n                // Only true when the multiplication doesn't overflow\n                // (c / a == b) || (a == 0)\n                success := or(eq(div(c, a), b), iszero(a))\n            }\n            // equivalent to: success ? c : 0\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `DIV` opcode returns zero when the denominator is 0.\n                result := div(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `MOD` opcode returns zero when the denominator is 0.\n                result := mod(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryAdd(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n     */\n    function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n        (, uint256 result) = trySub(a, b);\n        return result;\n    }\n\n    /**\n     * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryMul(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n     *\n     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n     * However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n     * one branch when needed, making this function more expensive.\n     */\n    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n        unchecked {\n            // branchless ternary works because:\n            // b ^ (a ^ b) == a\n            // b ^ 0 == b\n            return b ^ ((a ^ b) * SafeCast.toUint(condition));\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a > b, a, b);\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a < b, a, b);\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        unchecked {\n            // (a + b) / 2 can overflow.\n            return (a & b) + (a ^ b) / 2;\n        }\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n\n        // The following calculation ensures accurate ceiling division without overflow.\n        // Since a is non-zero, (a - 1) / b will not overflow.\n        // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n        // but the largest value we can obtain is type(uint256).max - 1, which happens\n        // when a = type(uint256).max and b = 1.\n        unchecked {\n            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n        }\n    }\n\n    /**\n     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     *\n     * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (high == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return low / denominator;\n            }\n\n            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n            if (denominator <= high) {\n                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [high low].\n            uint256 remainder;\n            assembly (\"memory-safe\") {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                high := sub(high, gt(remainder, low))\n                low := sub(low, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly (\"memory-safe\") {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [high low] by twos.\n                low := div(low, twos)\n\n                // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from high into low.\n            low |= high * twos;\n\n            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n            inverse *= 2 - denominator * inverse; // inverse mod 2³²\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n            // is no longer required.\n            result = low * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n    }\n\n    /**\n     * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n            if (high >= 1 << n) {\n                Panic.panic(Panic.UNDER_OVERFLOW);\n            }\n            return (high << (256 - n)) | (low >> n);\n        }\n    }\n\n    /**\n     * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n        return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n    }\n\n    /**\n     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n     *\n     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n     *\n     * If the input value is not inversible, 0 is returned.\n     *\n     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n     */\n    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n        unchecked {\n            if (n == 0) return 0;\n\n            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n            // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n            // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n            // ax + ny = 1\n            // ax = 1 + (-y)n\n            // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n            // If the remainder is 0 the gcd is n right away.\n            uint256 remainder = a % n;\n            uint256 gcd = n;\n\n            // Therefore the initial coefficients are:\n            // ax + ny = gcd(a, n) = n\n            // 0a + 1n = n\n            int256 x = 0;\n            int256 y = 1;\n\n            while (remainder != 0) {\n                uint256 quotient = gcd / remainder;\n\n                (gcd, remainder) = (\n                    // The old remainder is the next gcd to try.\n                    remainder,\n                    // Compute the next remainder.\n                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n                    // where gcd is at most n (capped to type(uint256).max)\n                    gcd - remainder * quotient\n                );\n\n                (x, y) = (\n                    // Increment the coefficient of a.\n                    y,\n                    // Decrement the coefficient of n.\n                    // Can overflow, but the result is casted to uint256 so that the\n                    // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n                    x - y * int256(quotient)\n                );\n            }\n\n            if (gcd != 1) return 0; // No inverse exists.\n            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n        }\n    }\n\n    /**\n     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n     *\n     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n     *\n     * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n     */\n    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n        unchecked {\n            return Math.modExp(a, p - 2, p);\n        }\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n     *\n     * Requirements:\n     * - modulus can't be zero\n     * - underlying staticcall to precompile must succeed\n     *\n     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n     * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n     * interpreted as 0.\n     */\n    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n        (bool success, uint256 result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n     * to operate modulo 0 or if the underlying precompile reverted.\n     *\n     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n     * of a revert, but the result may be incorrectly interpreted as 0.\n     */\n    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n        if (m == 0) return (false, 0);\n        assembly (\"memory-safe\") {\n            let ptr := mload(0x40)\n            // | Offset    | Content    | Content (Hex)                                                      |\n            // |-----------|------------|--------------------------------------------------------------------|\n            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n            // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n            mstore(ptr, 0x20)\n            mstore(add(ptr, 0x20), 0x20)\n            mstore(add(ptr, 0x40), 0x20)\n            mstore(add(ptr, 0x60), b)\n            mstore(add(ptr, 0x80), e)\n            mstore(add(ptr, 0xa0), m)\n\n            // Given the result < m, it's guaranteed to fit in 32 bytes,\n            // so we can use the memory scratch space located at offset 0.\n            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n            result := mload(0x00)\n        }\n    }\n\n    /**\n     * @dev Variant of {modExp} that supports inputs of arbitrary length.\n     */\n    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n        (bool success, bytes memory result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n     */\n    function tryModExp(\n        bytes memory b,\n        bytes memory e,\n        bytes memory m\n    ) internal view returns (bool success, bytes memory result) {\n        if (_zeroBytes(m)) return (false, new bytes(0));\n\n        uint256 mLen = m.length;\n\n        // Encode call args in result and move the free memory pointer\n        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n        assembly (\"memory-safe\") {\n            let dataPtr := add(result, 0x20)\n            // Write result on top of args to avoid allocating extra memory.\n            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n            // Overwrite the length.\n            // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n            mstore(result, mLen)\n            // Set the memory pointer after the returned data.\n            mstore(0x40, add(dataPtr, mLen))\n        }\n    }\n\n    /**\n     * @dev Returns whether the provided byte array is zero.\n     */\n    function _zeroBytes(bytes memory buffer) private pure returns (bool) {\n        uint256 chunk;\n        for (uint256 i = 0; i < buffer.length; i += 0x20) {\n            // See _unsafeReadBytesOffset from utils/Bytes.sol\n            assembly (\"memory-safe\") {\n                chunk := mload(add(add(buffer, 0x20), i))\n            }\n            if (chunk >> (8 * saturatingSub(i + 0x20, buffer.length)) != 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n     * using integer operations.\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        unchecked {\n            // Take care of easy edge cases when a == 0 or a == 1\n            if (a <= 1) {\n                return a;\n            }\n\n            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n            // the current value as `ε_n = | x_n - sqrt(a) |`.\n            //\n            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n            // bigger than any uint256.\n            //\n            // By noticing that\n            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n            // to the msb function.\n            uint256 aa = a;\n            uint256 xn = 1;\n\n            if (aa >= (1 << 128)) {\n                aa >>= 128;\n                xn <<= 64;\n            }\n            if (aa >= (1 << 64)) {\n                aa >>= 64;\n                xn <<= 32;\n            }\n            if (aa >= (1 << 32)) {\n                aa >>= 32;\n                xn <<= 16;\n            }\n            if (aa >= (1 << 16)) {\n                aa >>= 16;\n                xn <<= 8;\n            }\n            if (aa >= (1 << 8)) {\n                aa >>= 8;\n                xn <<= 4;\n            }\n            if (aa >= (1 << 4)) {\n                aa >>= 4;\n                xn <<= 2;\n            }\n            if (aa >= (1 << 2)) {\n                xn <<= 1;\n            }\n\n            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n            //\n            // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n            // This is going to be our x_0 (and ε_0)\n            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n            // From here, Newton's method give us:\n            // x_{n+1} = (x_n + a / x_n) / 2\n            //\n            // One should note that:\n            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n            //              = ((x_n² + a) / (2 * x_n))² - a\n            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n            //              = (x_n² - a)² / (2 * x_n)²\n            //              = ((x_n² - a) / (2 * x_n))²\n            //              ≥ 0\n            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n            //\n            // This gives us the proof of quadratic convergence of the sequence:\n            // ε_{n+1} = | x_{n+1} - sqrt(a) |\n            //         = | (x_n + a / x_n) / 2 - sqrt(a) |\n            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n            //         = | (x_n - sqrt(a))² / (2 * x_n) |\n            //         = | ε_n² / (2 * x_n) |\n            //         = ε_n² / | (2 * x_n) |\n            //\n            // For the first iteration, we have a special case where x_0 is known:\n            // ε_1 = ε_0² / | (2 * x_0) |\n            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))\n            //     ≤ 2**(e-3) / 3\n            //     ≤ 2**(e-3-log2(3))\n            //     ≤ 2**(e-4.5)\n            //\n            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n            // ε_{n+1} = ε_n² / | (2 * x_n) |\n            //         ≤ (2**(e-k))² / (2 * 2**(e-1))\n            //         ≤ 2**(2*e-2*k) / 2**e\n            //         ≤ 2**(e-2*k)\n            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above\n            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5\n            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9\n            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18\n            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36\n            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72\n\n            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n            // sqrt(a) or sqrt(a) + 1.\n            return xn - SafeCast.toUint(xn > a / xn);\n        }\n    }\n\n    /**\n     * @dev Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // If upper 8 bits of 16-bit half set, add 8 to result\n        r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n        // If upper 4 bits of 8-bit half set, add 4 to result\n        r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n        // Shifts value right by the current result and use it as an index into this lookup table:\n        //\n        // | x (4 bits) |  index  | table[index] = MSB position |\n        // |------------|---------|-----------------------------|\n        // |    0000    |    0    |        table[0] = 0         |\n        // |    0001    |    1    |        table[1] = 0         |\n        // |    0010    |    2    |        table[2] = 1         |\n        // |    0011    |    3    |        table[3] = 1         |\n        // |    0100    |    4    |        table[4] = 2         |\n        // |    0101    |    5    |        table[5] = 2         |\n        // |    0110    |    6    |        table[6] = 2         |\n        // |    0111    |    7    |        table[7] = 2         |\n        // |    1000    |    8    |        table[8] = 3         |\n        // |    1001    |    9    |        table[9] = 3         |\n        // |    1010    |   10    |        table[10] = 3        |\n        // |    1011    |   11    |        table[11] = 3        |\n        // |    1100    |   12    |        table[12] = 3        |\n        // |    1101    |   13    |        table[13] = 3        |\n        // |    1110    |   14    |        table[14] = 3        |\n        // |    1111    |   15    |        table[15] = 3        |\n        //\n        // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the first 16 bytes (most significant half).\n        assembly (\"memory-safe\") {\n            r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n        return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n\n    /**\n     * @dev Counts the number of leading zero bits in a uint256.\n     */\n    function clz(uint256 x) internal pure returns (uint256) {\n        return ternary(x == 0, 256, 255 - log2(x));\n    }\n}\n"},"V3/src/libraries/ProtocolConstants.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\n/// @dev Pips denominator where `1_000_000` is 100%.\nuint256 constant MAX_PIPS = 1_000_000;\n\n/// @dev Minimum receipt amount redeemable, one unit in pips, so the Splitter share cannot round to zero.\nuint256 constant MIN_REDEEM_AMOUNT = MAX_PIPS;\n\n/// @dev Sink gauge for idle voting power. Allocations to gauges that cannot receive emissions redirect\n///      here and accrue as surplus.\naddress constant ZERO_GAUGE = address(0);\n\n/// @dev Seconds in one weekly epoch.\nuint48 constant WEEK = 1 weeks;\n\n/// @dev Maximum staking period in seconds (4 years).\nuint48 constant MAXTIME = 4 * 365 days;\n\n/// @dev Lower bound for configured message lifetimes, rejects values that would expire every dispatch in transit.\nuint48 constant MIN_MESSAGE_LIFETIME = 2 minutes;\n\n/// @dev Upper bound for configured message lifetimes, keeps every stamped expiry far from uint48 overflow.\nuint48 constant MAX_MESSAGE_LIFETIME = 365 days;\n\n/// @dev Fixed point scale of 1e18.\nuint256 constant PRECISION = 1e18;\n\n/// @dev Smallest stake the protocol accepts, one whole TOKEN. A dust stake costs more to carry than it\n///      is worth, and a Relay seeded with one leaves a share supply small enough that the price per\n///      share can be lifted until a later deposit rounds down to a fraction of what it paid.\nuint256 constant MIN_STAKE_AMOUNT = 1e18;\n\n/// @dev Fixed-point scale used by the fee accumulators.\nuint256 constant FEE_ACCUMULATOR_PRECISION = 1e24;\n\n/// @dev Sentinel gauge address expressing deallocation intent in a gauge list. Shared so the root\n///      `Voter` and every `LeafVoter` agree on the value: root detects it in a bridged gauge list and\n///      the leaf turns it into a return-to-root deallocation. Derived from a fixed string so it can\n///      never collide with a real gauge.\naddress constant DEALLOC_GAUGE = address(uint160(uint256(keccak256('DROMOS_DEALLOC_GAUGE'))));\n"},"V3/src/metarouter/libraries/TokenRouterLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nimport {ICrossCollateralTokenRouter} from 'V3/interfaces/external/ICrossCollateralTokenRouter.sol';\nimport {ITokenRouter} from 'V3/interfaces/external/ITokenRouter.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title TokenRouterLib\n * @notice Stateless adapter for default and explicitly targeted Hyperlane token routers.\n * @dev These internal functions use the calling contract's balances and allowances. Bridge calls originate from\n *      that contract. The caller checks available funds, chooses the recipient and fee limits, and refunds unused\n *      funds. This library does not derive an ICA or read Metarouter state.\n */\nlibrary TokenRouterLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice A resolved asset route and its final beneficiary.\n   * @param sourceToken Source ERC20, or zero for native collateral through the default API.\n   * @param sourceRouter Source token router holding or burning the asset.\n   * @param destination Destination Hyperlane domain, independent of the EVM chain id.\n   * @param recipient Final beneficiary encoded into the token message.\n   * @param targetRouter Explicit destination token router, or zero to use the source router's enrolled route for\n   *        the destination domain.\n   */\n  struct Route {\n    address sourceToken;\n    address sourceRouter;\n    uint32 destination;\n    bytes32 recipient;\n    bytes32 targetRouter;\n  }\n\n  /**\n   * @notice Sends a validated transfer with a bounded temporary ERC20 approval and clears that approval afterward.\n   * @dev The caller validates the route and checks that principal plus token fees and the native value fit its\n   *      available balances. If the ERC20 spends the same balance as native currency, their combined spend must\n   *      fit that balance. ERC20 approval equals principal plus the authorized token fee; the bridge calculates\n   *      its actual fee during transfer. Native routes grant no approval and ignore `_tokenFee`. A failed transfer\n   *      propagates its revert and rolls back approval changes.\n   * @param _route Validated asset route and resolved beneficiary.\n   * @param _tokenAmount Source-token principal passed to the selected transfer API before destination scaling.\n   * @param _tokenFee Fees authorized in the source ERC20 in addition to principal; unused for native collateral.\n   * @param _nativeValue Native currency forwarded: the route's quote for the principal for native token routes, or\n   *        the message fee for ERC20 routes.\n   * @return _messageId Hyperlane message identifier returned by the selected token router.\n   */\n  function transferRemote(\n    Route memory _route,\n    uint256 _tokenAmount,\n    uint256 _tokenFee,\n    uint256 _nativeValue\n  ) internal returns (bytes32 _messageId) {\n    if (_route.sourceToken != address(0)) {\n      IERC20(_route.sourceToken).forceApprove(_route.sourceRouter, _tokenAmount + _tokenFee);\n    }\n    _messageId = _dispatch(_route, _tokenAmount, _nativeValue);\n    if (_route.sourceToken != address(0)) IERC20(_route.sourceToken).forceApprove(_route.sourceRouter, 0);\n  }\n\n  /**\n   * @notice Rejects explicit targets for the zero-address native token or the source router's own domain.\n   * @dev Default routes skip these checks and never read `localDomain`. The source CCR enforces target enrollment\n   *      during transfer. The target is the destination token router, not the beneficiary or ICA router.\n   * @param _route Asset route whose explicit mode is being validated.\n   */\n  function validateTargetRouter(Route memory _route) internal view {\n    // The default route for the destination domain needs no explicit-target validation.\n    if (_route.targetRouter == bytes32(0)) return;\n    if (_route.sourceToken == address(0)) revert IMetarouter.UnsupportedCrossCollateralToken();\n    if (ICrossCollateralTokenRouter(_route.sourceRouter).localDomain() == _route.destination) {\n      revert IMetarouter.SameDomainCrossCollateralTransfer();\n    }\n  }\n\n  /**\n   * @notice Requires the source router to report the asset the caller intends to transfer.\n   * @dev This compatibility check does not authenticate a caller-selected router or certify its delivery behavior.\n   * @param _route Asset route whose source-token identity is being validated.\n   */\n  function validateInputTokenMatches(Route memory _route) internal view {\n    if (ITokenRouter(_route.sourceRouter).token() != _route.sourceToken) revert IMetarouter.BridgeTokenMismatch();\n  }\n\n  /**\n   * @notice Quotes the selected route and returns the source-token amount it requires.\n   * @dev Sums every entry in `sourceToken` and rejects nonzero entries in other ERC20 tokens. On ERC20 routes, native\n   *      entries are skipped: the quote prices the budget while dispatch sends the smaller principal, so the native\n   *      value forwarded with the transfer is checked by the bridge instead.\n   * @param _route Asset route and final beneficiary used for both quoting and dispatch.\n   * @param _amount Source-token transfer amount being quoted.\n   * @return _total Total source-token amount required by the quote, including the transfer amount and token fees.\n   */\n  function quote(Route memory _route, uint256 _amount) internal view returns (uint256 _total) {\n    ITokenRouter.Quote[] memory _quotes = _route.targetRouter == bytes32(0)\n      ? ITokenRouter(_route.sourceRouter).quoteTransferRemote(_route.destination, _route.recipient, _amount)\n      : ICrossCollateralTokenRouter(_route.sourceRouter)\n        .quoteTransferRemoteTo(_route.destination, _route.recipient, _amount, _route.targetRouter);\n\n    uint256 _length = _quotes.length;\n    for (uint256 _i; _i < _length; ++_i) {\n      ITokenRouter.Quote memory _quote = _quotes[_i];\n      if (_quote.token == _route.sourceToken) {\n        _total += _quote.amount;\n      } else if (_quote.token != address(0)) {\n        if (_quote.amount != 0) revert IMetarouter.UnsupportedBridgeFeeToken(_quote.token);\n      }\n    }\n    if (_total < _amount) revert IMetarouter.InvalidBridgeQuote();\n  }\n\n  /**\n   * @notice Calls exactly the API selected for the route, without substituting a default route on failure.\n   * @param _route Asset route and resolved beneficiary.\n   * @param _tokenAmount Source-token amount passed to the router.\n   * @param _nativeValue Caller-authorized native value forwarded with the transfer.\n   * @return _messageId Identifier returned by the selected transfer API.\n   */\n  function _dispatch(\n    Route memory _route,\n    uint256 _tokenAmount,\n    uint256 _nativeValue\n  ) private returns (bytes32 _messageId) {\n    if (_route.targetRouter == bytes32(0)) {\n      // slither-disable-next-line arbitrary-send-eth\n      return ITokenRouter(_route.sourceRouter).transferRemote{value: _nativeValue}(\n        _route.destination, _route.recipient, _tokenAmount\n      );\n    }\n\n    // slither-disable-next-line arbitrary-send-eth\n    return ICrossCollateralTokenRouter(_route.sourceRouter).transferRemoteTo{value: _nativeValue}(\n      _route.destination, _route.recipient, _tokenAmount, _route.targetRouter\n    );\n  }\n}\n"},"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n    /**\n     * @dev Value doesn't fit in a uint of `bits` size.\n     */\n    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n    /**\n     * @dev An int value doesn't fit in a uint of `bits` size.\n     */\n    error SafeCastOverflowedIntToUint(int256 value);\n\n    /**\n     * @dev Value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n    /**\n     * @dev A uint value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedUintToInt(uint256 value);\n\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        if (value > type(uint248).max) {\n            revert SafeCastOverflowedUintDowncast(248, value);\n        }\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        if (value > type(uint240).max) {\n            revert SafeCastOverflowedUintDowncast(240, value);\n        }\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        if (value > type(uint232).max) {\n            revert SafeCastOverflowedUintDowncast(232, value);\n        }\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        if (value > type(uint224).max) {\n            revert SafeCastOverflowedUintDowncast(224, value);\n        }\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        if (value > type(uint216).max) {\n            revert SafeCastOverflowedUintDowncast(216, value);\n        }\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        if (value > type(uint208).max) {\n            revert SafeCastOverflowedUintDowncast(208, value);\n        }\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        if (value > type(uint200).max) {\n            revert SafeCastOverflowedUintDowncast(200, value);\n        }\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        if (value > type(uint192).max) {\n            revert SafeCastOverflowedUintDowncast(192, value);\n        }\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        if (value > type(uint184).max) {\n            revert SafeCastOverflowedUintDowncast(184, value);\n        }\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        if (value > type(uint176).max) {\n            revert SafeCastOverflowedUintDowncast(176, value);\n        }\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        if (value > type(uint168).max) {\n            revert SafeCastOverflowedUintDowncast(168, value);\n        }\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        if (value > type(uint160).max) {\n            revert SafeCastOverflowedUintDowncast(160, value);\n        }\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        if (value > type(uint152).max) {\n            revert SafeCastOverflowedUintDowncast(152, value);\n        }\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        if (value > type(uint144).max) {\n            revert SafeCastOverflowedUintDowncast(144, value);\n        }\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        if (value > type(uint136).max) {\n            revert SafeCastOverflowedUintDowncast(136, value);\n        }\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        if (value > type(uint128).max) {\n            revert SafeCastOverflowedUintDowncast(128, value);\n        }\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        if (value > type(uint120).max) {\n            revert SafeCastOverflowedUintDowncast(120, value);\n        }\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        if (value > type(uint112).max) {\n            revert SafeCastOverflowedUintDowncast(112, value);\n        }\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        if (value > type(uint104).max) {\n            revert SafeCastOverflowedUintDowncast(104, value);\n        }\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        if (value > type(uint96).max) {\n            revert SafeCastOverflowedUintDowncast(96, value);\n        }\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        if (value > type(uint88).max) {\n            revert SafeCastOverflowedUintDowncast(88, value);\n        }\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        if (value > type(uint80).max) {\n            revert SafeCastOverflowedUintDowncast(80, value);\n        }\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        if (value > type(uint72).max) {\n            revert SafeCastOverflowedUintDowncast(72, value);\n        }\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SafeCastOverflowedUintDowncast(64, value);\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        if (value > type(uint56).max) {\n            revert SafeCastOverflowedUintDowncast(56, value);\n        }\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert SafeCastOverflowedUintDowncast(48, value);\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert SafeCastOverflowedUintDowncast(40, value);\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert SafeCastOverflowedUintDowncast(32, value);\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        if (value > type(uint24).max) {\n            revert SafeCastOverflowedUintDowncast(24, value);\n        }\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        if (value > type(uint16).max) {\n            revert SafeCastOverflowedUintDowncast(16, value);\n        }\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        if (value > type(uint8).max) {\n            revert SafeCastOverflowedUintDowncast(8, value);\n        }\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        if (value < 0) {\n            revert SafeCastOverflowedIntToUint(value);\n        }\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(248, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(240, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(232, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(224, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(216, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(208, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(200, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(192, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(184, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(176, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(168, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(160, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(152, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(144, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(136, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(128, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(120, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(112, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(104, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(96, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(88, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(80, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(72, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(64, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(56, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(48, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(40, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(32, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(24, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(16, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(8, value);\n        }\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        if (value > uint256(type(int256).max)) {\n            revert SafeCastOverflowedUintToInt(value);\n        }\n        return int256(value);\n    }\n\n    /**\n     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n     */\n    function toUint(bool b) internal pure returns (uint256 u) {\n        assembly (\"memory-safe\") {\n            u := iszero(iszero(b))\n        }\n    }\n}\n"},"V3/src/interfaces/relay/IRelay.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IGovernor} from 'V3/interfaces/governor/IGovernor.sol';\nimport {IRelayToken} from 'V3/interfaces/relay/IRelayToken.sol';\nimport {IRelayVoteAdapter} from 'V3/interfaces/relay/IRelayVoteAdapter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\nimport {IVoterPaymentsModule} from 'V3/interfaces/vpm/IVoterPaymentsModule.sol';\n\n/**\n * @title  IRelay\n * @notice The base Relay surface: types, events, errors and every external member of RelayBase.\n *         Tier-specific members live on the concrete subclasses.\n */\ninterface IRelay {\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                      ENUMS                                         __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice The Relay tier, set at deployment; it decides the access model and the reward-processing flexibility.\n  /// @dev Maxi: permissionless deposits.\n  ///      ProtocolL1: whitelist-gated, fixed entrypoints.\n  ///      ProtocolL2: whitelist-gated, mutable entrypoints, sweep.\n  enum RelayType {\n    Maxi,\n    ProtocolL1,\n    ProtocolL2\n  }\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                     STRUCTS                                        __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Relay-level configuration, set at initialization.\n  /// @param tokenId The Relay's own sAERO that aggregates all pooled weight.\n  /// @param minDeposit Minimum requestable deposit (dust guard).\n  /// @param keeperWindow Time the keeper has to process a deposit before it becomes processable permissionlessly.\n  /// @param minWithdrawal Minimum shares per withdraw registration (dust guard). A partial exit must also\n  ///        leave at least this many free shares behind. The whole free position may always leave in one go.\n  /// @param entrypointTimelock Exit-window delay (seconds) of every timelocked change: an L2 entrypoint\n  ///        attachment, a leaf recipient, an operator, an ICA module keeper or leaf config and a rake raise; non-zero.\n  /// @param lockWeeks Lock horizon in weeks re-extended on each allocation; zero means a permanent stake.\n  /// @param evacuationWindow Seconds a queued withdrawal may wait unpaid (from its registration) before anyone may\n  ///        permanently close the Relay and start the evacuation. Fixed at creation, non-zero.\n  /// @param name Relay display name, also the stem of the satellite-token names at creation;\n  ///        mutable via `setName`.\n  /// @param symbol Stem of the satellite-token symbols; no setter.\n  /// @dev `minDeposit` is held to `MIN_STAKE_AMOUNT`, the same bar the seed stake clears.\n  ///      `minWithdrawal` only has to be non-zero.\n  struct RelayConfig {\n    uint256 tokenId;\n    uint256 minDeposit;\n    uint256 keeperWindow;\n    uint256 minWithdrawal;\n    uint256 entrypointTimelock;\n    uint48 lockWeeks;\n    uint48 evacuationWindow;\n    string name;\n    string symbol;\n  }\n\n  /// @notice Initialization inputs for a freshly cloned Relay. The factory names `vpm`, `governor`\n  ///         and `voteAdapter` from its own immutables, never the creator.\n  /// @param admin Initial owner: it holds the admin gates and manages every role bit.\n  /// @param keeper Initial KEEPER, granted the role.\n  /// @param voter Initial VOTER_ROLE operator, or zero to skip; rotatable by the owner afterwards.\n  /// @param compounder Entrypoint granted COMPOUNDER, or zero to skip; immutable on Maxi/L1.\n  ///        Naming neither entrypoint is rejected unless the Relay starts as L2, which attaches later.\n  /// @param converter Entrypoint granted CONVERTER, or zero to skip; immutable on Maxi/L1.\n  /// @param bootstrapOwner Non-zero recipient of the bootstrap principal minted 1:1 against the seed stake. The\n  ///        seed has no yield side, so it exits only once the Relay is closed. Use a dedicated address: a deposit\n  ///        from it while the Relay is open can sit below the exit floor until a top-up or closure.\n  /// @param rewardToken First reward token to register, or zero to leave the registry empty for KEEPER.\n  ///        Naming it here pins it in the same call that names the entrypoints it must match.\n  /// @param entrypointVetoer Holder of ENTRYPOINT_VETOER, or zero to run the timelock without a veto.\n  ///        Only seatable here: the public role paths refuse the bit, so an empty seat can never be\n  ///        filled later. Only the Protocol tier reads it.\n  /// @param rakeManagerAdmin Non-zero holder of RAKE_MANAGER_ADMIN.\n  /// @param protocolRakePips Genesis protocol rake, at most `MAX_RAKE_PIPS`.\n  /// @param allocatorRakePips Genesis allocator rake, at most `MAX_RAKE_PIPS`.\n  /// @param vpm Non-zero VoterPaymentsModule the Relay starts on.\n  /// @param governor Non-zero Governor the Relay starts casting into; movable through `setGovernor`.\n  /// @param voteAdapter Non-zero adapter every cast is encoded by; movable through `setGovernor`.\n  /// @param startAsLevel2 True to start a Protocol Relay directly as L2; tiers without an L2 path reject it.\n  /// @param ytTransferable True to deploy the yield token transferable; false makes it soulbound.\n  ///        Immutable switch on the YT clone; tiers with an allow list reject true.\n  /// @param config Relay configuration; the factory stamps `tokenId` and `lockWeeks` from the seed stake.\n  struct InitParams {\n    address admin;\n    address keeper;\n    address voter;\n    address compounder;\n    address converter;\n    address bootstrapOwner;\n    address rewardToken;\n    address entrypointVetoer;\n    address rakeManagerAdmin;\n    uint256 protocolRakePips;\n    uint256 allocatorRakePips;\n    IVoterPaymentsModule vpm;\n    IGovernor governor;\n    IRelayVoteAdapter voteAdapter;\n    bool startAsLevel2;\n    bool ytTransferable;\n    RelayConfig config;\n  }\n\n  /// @notice One entry of the deposit queue: a queued async deposit that waits for processing.\n  ///         Processing deletes the entry, which refunds its storage and marks the id consumed.\n  /// @param recipient Address the shares mint to, named at request.\n  /// @param requestedAt Request timestamp; after `keeperWindow` anyone can process the entry. Zero\n  ///        marks a consumed entry, because a live one always stamps its request's block timestamp.\n  /// @param tokenId Depositing sAERO the weight came from; only the `DepositProcessed` event reads it.\n  /// @param amount Staking weight moved into the Relay sAERO and held on chain0.\n  /// @dev The queue stores no link to the next entry. Ids run in sequence from one and are never\n  ///      reused, so every id up to `tail` was issued and the next id is always this id plus one.\n  ///      Deleting a consumed entry keeps that derivation intact — the id holds its place in the\n  ///      walk order — but a path that reused an id would break it and must store an explicit link.\n  struct PendingDeposit {\n    address recipient;\n    uint48 requestedAt;\n    uint128 tokenId;\n    uint128 amount;\n  }\n\n  /// @notice A reserved exit sitting in the FIFO withdraw queue until the drain settles it.\n  /// @param holder Owner of the escrowed shares, credited the weight on drain.\n  /// @param registeredAt Registration timestamp, stamped once and never moved; anchors the\n  ///        evacuation clock when the entry reaches the head of the queue.\n  /// @param mintFresh Whether the drain routes the weight to a freshly minted sAERO.\n  /// @param shares Shares the holder locked in place (non-transferable), burned when the entry settles.\n  /// @param destination Destination sAERO the weight returns to, zero when `mintFresh` is set.\n  /// @dev Packs into two slots. `MINT_SENTINEL` lives only at the API boundary, because a sentinel\n  ///      inside `destination`'s 72-bit range would collide with a real token id: registration\n  ///      folds it into `mintFresh`, and the `withdrawals` getter and the events rebuild it.\n  struct WithdrawEntry {\n    address holder;\n    uint48 registeredAt;\n    bool mintFresh;\n    uint128 shares;\n    uint72 destination;\n  }\n\n  /// @notice A proposed leaf claim recipient waiting out its timelock.\n  /// @param recipient Address the claims for the chain would move to.\n  /// @param proposedAt Timestamp the proposal was stamped; the delay runs from here.\n  struct PendingRecipient {\n    address recipient;\n    uint48 proposedAt;\n  }\n\n  /// @notice A proposed leaf operator waiting out its timelock.\n  /// @param operator Address that would be named operator of the Relay's sAERO on the chain.\n  /// @param proposedAt Timestamp the proposal was stamped; the delay runs from here.\n  struct PendingOperator {\n    address operator;\n    uint48 proposedAt;\n  }\n\n  /// @notice One ERC-20 leg of a sweep, moved from the Relay's own balance on root (root-only, no\n  ///         cross-chain dispatch).\n  /// @param token Token to sweep, held by the Relay on root.\n  /// @param recipient Destination of the swept tokens.\n  /// @param amount Amount to move.\n  struct ERC20Sweep {\n    address token;\n    address recipient;\n    uint256 amount;\n  }\n\n  /// @notice The rake rates and the pending rate change.\n  /// @param protocolPips Protocol rake, in pips of the yield batch.\n  /// @param allocatorPips Allocator rake, in pips of the batch left after the protocol rake.\n  /// @param pendingProtocolPips Proposed protocol rake.\n  /// @param pendingAllocatorPips Proposed allocator rake.\n  /// @param executableAt Timestamp from which the proposed pair can be executed; zero when none is pending.\n  struct RakeState {\n    uint24 protocolPips;\n    uint24 allocatorPips;\n    uint24 pendingProtocolPips;\n    uint24 pendingAllocatorPips;\n    uint48 executableAt;\n  }\n\n  /// @notice Rake accrued in one token and not yet collected.\n  /// @param protocol Protocol lane, collected to the factory's rake treasury.\n  /// @param allocator Allocator lane, collected by VOTER_ROLE.\n  struct FeeAccrual {\n    uint128 protocol;\n    uint128 allocator;\n  }\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                      EVENTS                                        __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Emitted when the owner adds or removes an address from the allow list gating deposits and\n  ///         holder-to-holder yield-token transfers (both ends must be listed).\n  /// @param account Address whose permission changed.\n  /// @param allowed True when permitted, false when revoked.\n  event AllowListSet(address indexed account, bool allowed);\n\n  /// @notice Emitted when the owner hard-kicks an account: de-listed, and its free position forced\n  ///         into the withdraw queue.\n  /// @param account Account that was kicked.\n  /// @param shares Free shares forced into the withdraw queue (zero when it held none).\n  event Kicked(address indexed account, uint256 shares);\n\n  /// @notice Emitted on the one-way promotion of a Protocol L1 Relay to Protocol L2.\n  /// @param admin Address the ownership moved to at promotion.\n  event PromotedToLevel2(address indexed admin);\n\n  /// @notice Emitted when the owner proposes attaching an entrypoint on an L2 Relay.\n  /// @param role Entrypoint role proposed (COMPOUNDER or CONVERTER).\n  /// @param account Entrypoint address proposed for the role.\n  /// @param executableAt Timestamp from which the proposal may be executed (`now + entrypointTimelock`).\n  event EntrypointProposed(uint256 indexed role, address indexed account, uint256 executableAt);\n\n  /// @notice Emitted when ENTRYPOINT_VETOER cancels a pending entrypoint proposal.\n  /// @param role Entrypoint role the cancelled proposal targeted.\n  /// @param account Entrypoint address the cancelled proposal targeted.\n  event EntrypointVetoed(uint256 indexed role, address indexed account);\n\n  /// @notice Emitted on every successful allocation cast against the Voter.\n  /// @param caller Holder of VOTER_ROLE that sent the allocation.\n  event Allocated(address indexed caller);\n\n  /// @notice Emitted when the Relay is permanently closed.\n  /// @param caller Address that closed the Relay (anyone once a withdrawal has waited the full window unpaid,\n  ///        the owner at will).\n  event Closed(address indexed caller);\n\n  /// @notice Emitted when an evacuation dispatches one chain's full pull-out on a closed Relay.\n  ///         Fires again on every re-dispatch.\n  /// @param caller Address that triggered the evacuation (permissionless once closed).\n  event Evacuated(address indexed caller);\n\n  /// @notice Emitted when an emergency deallocation returns one suspended chain's weight.\n  /// @param chainId Suspended chain whose weight returns.\n  /// @param caller Address that triggered it (KEEPER while open, anyone once closed).\n  event EmergencyDeallocated(uint256 indexed chainId, address indexed caller);\n\n  /// @notice Emitted when a depositor requests an async deposit.\n  /// @param tokenId Depositing sAERO.\n  /// @param recipient Share recipient named at request.\n  /// @param amount Net staking weight received by the Relay sAERO, after the VPM protocol fee.\n  /// @param id Deposit-queue id the entry was appended under, addressing it for individual processing.\n  event DepositRequested(uint256 indexed tokenId, address indexed recipient, uint256 amount, uint256 id);\n\n  /// @notice Emitted when a pending deposit is processed and its shares mint.\n  /// @param tokenId Depositing sAERO.\n  /// @param recipient Share recipient recorded at request.\n  /// @param amount Staking weight admitted into the live backing.\n  /// @param sharesMinted Shares minted at the current ratio.\n  event DepositProcessed(uint256 indexed tokenId, address indexed recipient, uint256 amount, uint256 sharesMinted);\n\n  /// @notice Emitted when a holder reserves an exit on the withdraw queue.\n  /// @param holder Owner of the escrowed shares.\n  /// @param shares Shares escrowed into the queue.\n  /// @param destination Destination sAERO, or the mint sentinel for a fresh one.\n  /// @param id Id the exit was appended under; ids run in sequence from one.\n  event WithdrawRegistered(address indexed holder, uint256 shares, uint256 destination, uint256 id);\n\n  /// @notice Emitted when the drain settles a queued exit.\n  /// @param holder Owner credited the returned weight.\n  /// @param sharesBurnt Escrowed shares burned to settle the exit.\n  /// @param amount Net staking weight received by the destination sAERO, after the VPM protocol fee.\n  /// @param destinationTokenId Destination sAERO that received the weight (freshly minted on fallback).\n  event WithdrawProcessed(address indexed holder, uint256 sharesBurnt, uint256 amount, uint256 destinationTokenId);\n\n  /// @notice Emitted when a reward token is registered in the accumulator registry.\n  /// @param token Reward token added.\n  event RewardTokenAdded(address indexed token);\n\n  /// @notice Emitted when a reward token that never distributed anything leaves the registry.\n  /// @param token Reward token dropped.\n  event RewardTokenRemoved(address indexed token);\n\n  /// @notice Emitted when the Relay moves to another VoterPaymentsModule.\n  /// @param vpm The module every later deposit and withdrawal moves weight through.\n  event VoterPaymentsModuleSet(address indexed vpm);\n\n  /// @notice Emitted when the Relay is pointed at another Governor.\n  /// @param governor The Governor every later `expressVote` casts into.\n  /// @param voteAdapter The adapter translating casts for it.\n  event GovernorSet(address indexed governor, address indexed voteAdapter);\n\n  /// @notice Emitted when the Relay's display name changes.\n  /// @param oldName The name being replaced.\n  /// @param newName The name from here on.\n  event NameChanged(string oldName, string newName);\n\n  /// @notice Emitted when a reward batch advances a token's per-share accumulator.\n  /// @param token Reward token notified.\n  /// @param amount Amount accounted: what the advanced index can pay out, rounded up. The rest of\n  ///        the batch stays un-accounted for the next notify.\n  /// @param newIndex Accumulator index after the batch.\n  event RewardNotified(address indexed token, uint256 amount, uint256 newIndex);\n\n  /// @notice Emitted when a holder claims accrued reward in a token.\n  /// @param holder Holder whose accrual was settled.\n  /// @param token Reward token claimed.\n  /// @param to Recipient of the payout.\n  /// @param amount Amount transferred out.\n  event RewardClaimed(address indexed holder, address indexed token, address indexed to, uint256 amount);\n\n  /// @notice Emitted on every successful compound into the Relay sAERO.\n  /// @param amount TOKEN amount staked into the underlying position.\n  event Compounded(uint256 amount);\n\n  /// @notice Emitted when an entrypoint pulls a token out of the Relay.\n  /// @param entrypoint Entrypoint the token was sent to.\n  /// @param token Token pulled.\n  /// @param amount Amount transferred out.\n  event Pulled(address indexed entrypoint, address indexed token, uint256 amount);\n\n  /// @notice Emitted for each leg of a sweep.\n  /// @param token Token moved.\n  /// @param recipient Recipient the SWEEPER named.\n  /// @param amount Amount transferred out.\n  event TokenSwept(address indexed token, address indexed recipient, uint256 amount);\n\n  /// @notice Emitted once at initialization when the two satellite tokens are cloned and bound.\n  /// @param principalToken The principal token (PT) clone: priced position, withdraw right.\n  /// @param yieldToken The yield token (YT) clone: the balance the reward accumulator reads.\n  event RelayTokensDeployed(address principalToken, address yieldToken);\n\n  /// @notice Emitted when the owner sets (or clears) the recipient that fee/incentive claims for a leaf\n  ///         chain land at on that chain.\n  /// @param chainId Leaf chain the recipient applies to.\n  /// @param recipient Configured claim recipient, or zero when cleared.\n  event LeafRecipientSet(uint256 indexed chainId, address indexed recipient);\n\n  /// @notice Emitted when the owner proposes a new recipient for a leaf chain's fee/incentive claims.\n  /// @param chainId Leaf chain the proposed recipient applies to.\n  /// @param recipient Proposed claim recipient.\n  /// @param executableAt Timestamp from which the proposal may be executed (`now + entrypointTimelock`).\n  event LeafRecipientProposed(uint256 indexed chainId, address indexed recipient, uint256 executableAt);\n\n  /// @notice Emitted when a pending leaf recipient proposal is cancelled.\n  /// @param chainId Leaf chain whose proposal was cancelled.\n  event LeafRecipientProposalCancelled(uint256 indexed chainId);\n\n  /// @notice Emitted when an operator is proposed for a leaf chain.\n  /// @param chainId Leaf chain the operator would act on.\n  /// @param operator Address proposed as operator.\n  /// @param executableAt Timestamp the proposal can be executed at.\n  event OperatorProposed(uint256 indexed chainId, address indexed operator, uint256 executableAt);\n\n  /// @notice Emitted when an operator update is sent to a leaf chain.\n  /// @param chainId Leaf chain the update was sent to.\n  /// @param operator Address named operator; zero clears the seat.\n  /// @dev The leaf applies it when the message arrives, so this records the dispatch and not the\n  ///      landing. A message that expires in transit leaves the leaf on its previous operator.\n  event OperatorDispatched(uint256 indexed chainId, address indexed operator);\n\n  /// @notice Emitted when a pending operator proposal is cancelled.\n  /// @param chainId Leaf chain whose proposal was cancelled.\n  event OperatorProposalCancelled(uint256 indexed chainId);\n\n  /// @notice Emitted when a principal-token holder expresses a preference on a governance proposal\n  ///         and the Relay casts their slice of its weight.\n  /// @param proposalId Proposal the preference applies to.\n  /// @param holder Principal-token holder expressing the preference.\n  /// @param support Support the holder requested: 0 Against, 1 For, 2 Abstain, 255 fractional.\n  /// @param weightUsed Voting weight consumed from the holder's snapshot slice by this call.\n  /// @param params The params the holder supplied (empty for nominal support, three packed `uint128`\n  ///        weights for fractional).\n  event VoteExpressed(\n    uint256 indexed proposalId, address indexed holder, uint8 support, uint256 weightUsed, bytes params\n  );\n\n  /// @notice Emitted when RAKE_MANAGER_ADMIN seats or removes a RAKE_MANAGER.\n  /// @param account Address whose RAKE_MANAGER role changed.\n  /// @param enabled True when seated, false when removed.\n  event RakeManagerSet(address indexed account, bool enabled);\n\n  /// @notice Emitted when the RAKE_MANAGER_ADMIN seat moves.\n  /// @param previousAdmin Address that held the seat.\n  /// @param newAdmin Address that holds the seat now.\n  event RakeManagerAdminTransferred(address indexed previousAdmin, address indexed newAdmin);\n\n  /// @notice Emitted when a rake pair that raises a rate is proposed.\n  /// @param protocolPips Proposed protocol rake.\n  /// @param allocatorPips Proposed allocator rake.\n  /// @param executableAt Timestamp from which the pair can be executed.\n  event RakesProposed(uint256 protocolPips, uint256 allocatorPips, uint256 executableAt);\n\n  /// @notice Emitted when the rake rates change.\n  /// @param protocolPips Protocol rake from here on.\n  /// @param allocatorPips Allocator rake from here on.\n  event RakesSet(uint256 protocolPips, uint256 allocatorPips);\n\n  /// @notice Emitted when a yield batch pays the rake.\n  /// @param token Token of the yield batch.\n  /// @param protocolFee Amount booked to the protocol lane.\n  /// @param allocatorFee Amount booked to the allocator lane.\n  event RakeSkimmed(address indexed token, uint256 protocolFee, uint256 allocatorFee);\n\n  /// @notice Emitted when the protocol lane of a token is collected.\n  /// @param token Token collected.\n  /// @param recipient Rake treasury that received the amount.\n  /// @param amount Amount transferred.\n  event ProtocolFeesCollected(address indexed token, address indexed recipient, uint256 amount);\n\n  /// @notice Emitted when the allocator lane of a token is collected.\n  /// @param token Token collected.\n  /// @param recipient Address that received the amount.\n  /// @param amount Amount transferred.\n  event AllocatorFeesCollected(address indexed token, address indexed recipient, uint256 amount);\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                  CUSTOM ERRORS                                     __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Thrown when the caller is not authorized over the source sAERO through the VPM.\n  error NotAuthorized();\n\n  /// @notice Thrown when the named VoterPaymentsModule is not one the escrow authorizes.\n  error ModuleNotAuthorized();\n\n  /// @notice Thrown at construction when the Relay does not own the sAERO it is being bound to.\n  error NotTokenOwner();\n\n  /// @notice Thrown at construction when the bound sAERO carries less than `MIN_STAKE_AMOUNT` of\n  ///         initial stake (the seed that blocks the first-depositor inflation attack).\n  error SeedTooSmall();\n\n  /// @notice Thrown on a permissioned Relay when a deposit or share transfer hits an address not on the allow list.\n  error NotAllowed();\n\n  /// @notice Thrown when a requested deposit is below the configured minimum.\n  error BelowMinimumDeposit();\n\n  /// @notice Thrown when a requested deposit would mint zero shares at the current share ratio.\n  error ZeroShares();\n\n  /// @notice Thrown when a registered withdrawal is zero, is below the configured minimum, or would leave a\n  ///         free remainder below it. The holder's whole free position is always accepted.\n  error BelowMinimumWithdrawal();\n\n  /// @notice Thrown when processing the deposit queue with nothing pending.\n  error NoPendingDeposits();\n\n  /// @notice Thrown when processing overdue deposits with an empty ids array.\n  error EmptyDepositIds();\n\n  /// @notice Thrown when processing a deposit id that was never issued.\n  error DepositNotFound();\n\n  /// @notice Thrown when every deposit entry named for processing was already processed.\n  error DepositAlreadyProcessed();\n\n  /// @notice Thrown when an amount exceeds the un-accounted balance on hand (`balanceOf - accountedBalance`).\n  error RewardExceedsBalance();\n\n  /// @notice Thrown when a zero address is supplied where a non-zero one is required.\n  error ZeroAddress();\n\n  /// @notice Thrown at construction when `minDeposit` is below `MIN_STAKE_AMOUNT`, or when\n  ///         `minWithdrawal` is zero. A zero floor admits a zero-amount entry, and a zero-share exit\n  ///         permanently stalls the withdraw FIFO; a dust deposit floor bounds no rounding loss.\n  error QueueFloorTooSmall();\n\n  /// @notice Thrown when registering a withdrawal for more shares than the caller has free\n  ///         (un-escrowed). An open Relay checks both satellites; a closed one checks the\n  ///         principal alone.\n  error InsufficientFreeShares();\n\n  /// @notice Thrown when a transfer would move shares the holder has escrowed into the withdraw queue.\n  error EscrowedSharesLocked();\n\n  /// @notice Thrown on `renounceOwnership`: a vacant owner seat would freeze every owner-gated path,\n  ///         so the ownership can only be handed over.\n  error OwnershipRenounceDisabled();\n\n  /// @notice Thrown when a public grant, revoke or renounce names a restricted role.\n  error RoleRestricted();\n\n  /// @notice Thrown on the permissionless deposit path when the named entry is still within keeperWindow.\n  error KeeperWindowNotElapsed();\n\n  /// @notice Thrown when initializing a Relay with a zero entrypoint timelock.\n  error InvalidEntrypointTimelock();\n\n  /// @notice Thrown when a Relay whose entrypoints are fixed at initialization names neither a\n  ///         compounder nor a converter: rewards reaching it could never be processed. A Relay\n  ///         starting as Protocol L2 is exempt, it attaches entrypoints through the timelocked flow.\n  error MissingEntrypoint();\n\n  /// @notice Thrown when registering an exit whose destination is the Relay's own sAERO or an id that does\n  ///         not fit the stored destination field.\n  error InvalidDestination();\n\n  /// @notice Thrown when notifying or claiming a token not in the reward registry.\n  error UnknownRewardToken();\n\n  /// @notice Thrown when adding a reward token already present in the registry.\n  error RewardTokenAlreadyAdded();\n\n  /// @notice Thrown when a Maxi or Protocol L1 Relay tries to register a second reward token.\n  error RewardRegistryLocked();\n\n  /// @notice Thrown when registering a reward token would exceed `MAX_REWARD_TOKENS`.\n  error RewardRegistryFull();\n\n  /// @notice Thrown when registering a reward token that holds no code, which no claim could\n  ///         ever transfer out.\n  error RewardTokenNotAContract();\n\n  /// @notice Thrown when registering the Relay itself or one of its satellites as a reward token.\n  error InvalidRewardToken();\n\n  /// @notice Thrown when dropping a reward token that already distributed a batch, whose holders\n  ///         would lose the rights it left behind.\n  error RewardTokenPaid();\n\n  /// @notice Thrown when promoting a Relay that is not Protocol L1, or initializing a tier without\n  ///         an L2 path with `startAsLevel2`.\n  error NotPromotable();\n\n  /// @notice Thrown when initializing an allow-listed tier with a transferable yield token: a\n  ///         kicked holder who sold YT would have no pair left to burn, so eviction would be a no-op.\n  error TransferableYieldTokenNotAllowed();\n\n  /// @notice Thrown when a satellite token implementation holds no code, which a clone of it cannot report.\n  error ImplementationNotAContract();\n\n  /// @notice Thrown when a cloned satellite token did not come out bound to this Relay with the\n  ///         requested transferability.\n  error SatelliteNotInitialized();\n\n  /// @notice Thrown when a Level-2-only action (e.g. sweep) runs on a Maxi or Protocol L1 Relay.\n  error NotLevel2();\n\n  /// @notice Thrown when proposing an entrypoint for a role other than COMPOUNDER or CONVERTER.\n  error InvalidEntrypointRole();\n\n  /// @notice Thrown when executing an entrypoint attachment that was never proposed.\n  error EntrypointNotProposed();\n\n  /// @notice Thrown when proposing an entrypoint that is bound to a different Relay.\n  error EntrypointNotBound();\n\n  /// @notice Thrown when executing an entrypoint attachment before its timelock has elapsed.\n  error EntrypointTimelockNotElapsed();\n\n  /// @notice Thrown when executing a leaf recipient that was never proposed, or already landed.\n  error LeafRecipientNotProposed();\n\n  /// @notice Thrown when executing a proposed leaf recipient before its timelock has elapsed.\n  error LeafRecipientTimelockNotElapsed();\n\n  /// @notice Thrown when proposing a leaf recipient for the Relay's own chain, whose claims always\n  ///         pay the Relay itself.\n  error LeafRecipientOnRoot();\n\n  /// @notice Thrown when executing an operator for a chain that has no proposal pending.\n  error OperatorNotProposed();\n\n  /// @notice Thrown when executing an operator proposal before its timelock has elapsed.\n  error OperatorTimelockNotElapsed();\n\n  /// @notice Thrown when an allocation, a deposit request or a close reaches a permanently\n  ///         closed Relay.\n  error RelayClosed();\n\n  /// @notice Thrown when evacuating an open Relay: the dispatch requires the closed state.\n  error RelayNotClosed();\n\n  /// @notice Thrown when a flexible-vote cast would send calldata whose selector is not the\n  ///         Governor's fractional cast, so a rotated Governor cannot bear arbitrary authority.\n  error UnexpectedCastSelector();\n\n  /// @notice Thrown at initialization when the evacuation window is zero, which would let anyone\n  ///         close a working Relay.\n  error InvalidEvacuationWindow();\n\n  /// @notice Thrown at initialization when the keeper window is zero, which would make the overdue\n  ///         drain permissionless from the first block.\n  error InvalidKeeperWindow();\n\n  /// @notice Thrown at initialization when `lockWeeks` disagrees with the seed stake's permanence:\n  ///         a permanent seed with non-zero `lockWeeks` would revert every lock extension, and a\n  ///         time-locked seed with zero `lockWeeks` would silently decay.\n  error LockWeeksMismatch();\n\n  /// @notice Thrown at initialization when `lockWeeks` reaches past the escrow's MAXTIME once its\n  ///         week floor is applied, which would make the lock refresh fail part of every week.\n  error LockWeeksTooLong();\n\n  /// @notice Thrown when closing a Relay whose withdraw queue is empty.\n  error NoQueuedWithdrawal();\n\n  /// @notice Thrown when closing a Relay before the oldest queued withdrawal has waited a full evacuation window.\n  error EvacuationWindowNotElapsed();\n\n  /// @notice Thrown when closing a Relay whose oldest queued withdrawal the free chain0 weight can pay: the remedy\n  ///         is a drain, not a shutdown.\n  error HeadIsCovered();\n\n  /// @notice Thrown when an evacuation names a chain holding no booked weight.\n  error NothingToEvacuate();\n\n  /// @notice Thrown when an allocation carries no chain and no gauge dispatches.\n  error EmptyAllocation();\n\n  /// @notice Thrown when an allocation's growth exceeds the free chain0 weight minus the withdrawal\n  ///         reserve, the queue's share of the whole stake, which is owed before anything else is\n  ///         allocated.\n  error InsufficientFreeWeight();\n\n  /// @notice Thrown when a claim resolves to a zero payout.\n  error NothingToClaim();\n\n  /// @notice Thrown when a leaf-chain claim has no configured recipient (it cannot dispatch to zero).\n  error RecipientNotSet();\n\n  /// @notice Thrown when a root claim is funded with msg.value (no cross-chain dispatch, no fee).\n  error NoValueOnRootClaim();\n\n  /// @notice Thrown when notifying a reward while the share supply is zero.\n  error NoSupply();\n\n  /// @notice Thrown when compounding into a Relay with no principal outstanding, where the added\n  ///         backing would have no claimant.\n  error NoPrincipalSupply();\n\n  /// @notice Thrown when a reward batch is too small to advance the per-share index (it would floor\n  ///         to zero and lock as owed-but-undistributed).\n  error RewardTooSmall();\n\n  /// @notice Thrown when the caller held no principal token at the proposal snapshot.\n  error NoVotingPower();\n\n  /// @notice Thrown when the caller has already consumed their full slice on this proposal.\n  error AlreadyVoted();\n\n  /// @notice Thrown when the requested fractional weights exceed the caller's remaining slice.\n  error ExceedsRemainingSlice();\n\n  /// @notice Thrown when governance support is not 0/1/2/255, or the params length disagrees with it.\n  error InvalidSupport();\n\n  /// @notice Thrown at construction when the rake ceiling is not below `MAX_PIPS`.\n  error InvalidRakeCeiling();\n\n  /// @notice Thrown when a rake rate exceeds `MAX_RAKE_PIPS`.\n  error RakeAboveCeiling();\n\n  /// @notice Thrown when executing a rake change while none is pending.\n  error NoPendingRakes();\n\n  /// @notice Thrown when executing a rake change before its timelock has elapsed.\n  error RakeTimelockActive();\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                    FUNCTIONS                                       __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Initializes a freshly cloned Relay. Callable once, by the factory, in the\n  ///         clone-creation transaction.\n  /// @param _params Initialization inputs (operators, entrypoints, tier flag, configuration).\n  function initialize(InitParams memory _params) external;\n\n  /// @notice Requests an async deposit from the caller's sAERO, crediting the eventual shares to\n  ///         the sAERO's current owner. No shares mint here: the entry waits on the deposit queue\n  ///         until the keeper processes it, or anyone after it ages past `keeperWindow`.\n  /// @param _tokenId Source sAERO whose weight enters the Relay.\n  /// @param _amount Staking weight pulled from the source sAERO; the Relay records the net weight\n  ///        after the VPM protocol fee.\n  function requestDeposit(uint256 _tokenId, uint256 _amount) external;\n\n  /// @notice Requests an async deposit from the caller's sAERO, naming the share recipient.\n  /// @param _tokenId Source sAERO whose weight enters the Relay.\n  /// @param _amount Staking weight pulled from the source sAERO (gross of the VPM protocol fee).\n  /// @param _recipient Address the shares mint to at admission.\n  function requestDeposit(uint256 _tokenId, uint256 _amount, address _recipient) external;\n\n  /// @notice Keeper entry that processes pending deposits in request order and mints shares.\n  /// @param _maxEntries Max deposit-queue entries to visit this call; a consumed entry the walk\n  ///        visits spends budget like a live one.\n  /// @dev The keeper triggers the entrypoints first so existing holders capture the reward batch,\n  ///      then processes deposits so fresh shares mint at the settled ratio.\n  function processPending(uint256 _maxEntries) external;\n\n  /// @notice Permissionless liveness fallback: process the named pending deposits after each one\n  ///         ages past `keeperWindow`, so neither the keeper nor a backlog can block an entry.\n  /// @param _ids Deposit-queue ids to process, in the given order.\n  /// @dev Skips an entry that was already processed, and reverts if nothing is left to process.\n  ///      Also reverts on an empty ids array, an id that was never issued, or an entry that is\n  ///      still inside the keeper window.\n  function processOverduePending(uint256[] calldata _ids) external;\n\n  /// @notice Registers an exit: escrows `_shares` into the FIFO withdraw queue, to be settled later\n  ///         against the idle chain0 weight. Permissionless; cannot be cancelled.\n  /// @param _shares Shares to escrow and burn at drain.\n  /// @param _destination Existing sAERO the weight is sent to, or MINT_SENTINEL for a freshly minted\n  ///        one. Read at settlement rather than now: the weight lands on that sAERO, whoever owns it\n  ///        then. `processWithdrawals` says when a fresh sAERO replaces it. `InvalidDestination` lists\n  ///        the rejected ids.\n  /// @dev Escrowed shares stay on the holder, accruing rewards until burned, but are locked in\n  ///      place. On a closed Relay the free-share cover is asked of the principal alone, so a\n  ///      holder that sold its yield side can still leave; the drain mirrors this and burns only\n  ///      the principal past closure, leaving the yield token its claim on the reward tail.\n  function registerOnWithdrawQueue(uint256 _shares, uint256 _destination) external;\n\n  /// @notice Drains up to `_maxEntries` queued exits against the free chain0 weight, read live from\n  ///         the Voter. Permissionless: the caller picks no route.\n  /// @param _maxEntries Max exits to settle this call.\n  /// @dev An exit registered with `MINT_SENTINEL`, and every eviction, goes to a fresh sAERO minted to\n  ///      the holder. The mint skips the ERC-721 receiver check, so a holder that is a contract must be\n  ///      able to use the sAERO. Any other exit goes to its registered sAERO, unless that sAERO does\n  ///      not exist or unlocks before the Relay's own: then it falls back to a fresh sAERO too. On a\n  ///      permanent Relay, any decaying destination falls back, whatever its unlock. Zero, the escrow's\n  ///      fee accumulator, is permanent, so an exit naming it settles there and hands the weight to the\n  ///      protocol.\n  /// @dev The drain stops early when the free weight no longer covers the next exit.\n  function processWithdrawals(uint256 _maxEntries) external;\n\n  /// @notice Allocates the pooled voting power: forwards the caller's chain and gauge dispatches to\n  ///         the Voter in one composed call. The Relay stores no strategy.\n  /// @param _chainDispatches Per-chain additive deltas funded from the idle chain0 weight, with\n  ///        their dispatch funding; strictly ascending. A zero delta only refreshes the chain's\n  ///        stored shape.\n  /// @param _gaugeDispatches Per-chain gauge overwrites with their dispatch funding. A list must\n  ///        cover the chain's booked amount exactly; a `DEALLOC_GAUGE` entry starts a leaf-first\n  ///        return of that amount to chain0, its return cost paid from the entry's `value`.\n  /// @param _refundRecipient Recipient of any unused dispatch value, refunded by the transport.\n  /// @dev The Relay checks only the withdrawal reserve and the closed flag; the Voter validates\n  ///      everything else (ordering, chain status, gauge budgets, the msg.value split).\n  function allocate(\n    IVoter.ChainAllocationDispatch[] calldata _chainDispatches,\n    IVoter.GaugeAllocationDispatch[] calldata _gaugeDispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /// @notice Refreshes the Relay sAERO's lock to its configured horizon. Permissionless; a no-op\n  ///         on permanent Relays.\n  function extendLock() external;\n\n  /// @notice Permanently closes the Relay. Permissionless when the oldest queued withdrawal has waited a full\n  ///         evacuation window and the free chain0 weight cannot pay it; the owner closes at will. The allocated\n  ///         chains come home afterwards through `evacuate`, one per call.\n  function close() external;\n\n  /// @notice Pulls the named chain's full booked weight back to chain0 on a closed Relay.\n  ///         Permissionless, and a chain whose message never applied can be re-dispatched.\n  /// @param _chainId Allocated chain whose full booked weight returns; the Voter enforces its own\n  ///        chain rules on the dispatch.\n  /// @param _gasLimit Destination gas for the leaf message; msg.value covers the dispatch fee and\n  ///        the chain's deallocation return cost, quoted off-chain.\n  /// @param _refundRecipient Recipient of any unused dispatch value.\n  function evacuate(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Pulls the Relay's weight off a suspended chain straight back to chain0 through the\n  ///         Voter's emergency path. KEEPER-gated while the Relay is open; permissionless once\n  ///         closed.\n  /// @param _chainId Suspended chain whose full booked weight returns.\n  /// @param _gasLimit Destination gas for the emergency message to the leaf.\n  /// @param _refundRecipient Recipient of any unused dispatch value.\n  /// @dev The Voter enforces its own preconditions (the chain is Suspended and emergency\n  ///      deallocation is enabled for it) and credits chain0 synchronously.\n  function emergencyDeallocate(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Expresses a governance preference as a principal-token holder: the Relay casts a\n  ///         fractional vote with its own sAERO, sized to the caller's snapshot slice.\n  /// @param _proposalId Proposal being voted on.\n  /// @param _support Preference: 0 Against, 1 For, 2 Abstain (empty params, spends the whole\n  ///        remaining slice), or 255 fractional (params carry three packed `uint128` weights).\n  /// @param _params Counting-module params matching `_support`.\n  /// @param _reason Free-form reason string forwarded to the Governor.\n  /// @dev Permissionless: the slice itself is the gate — a caller with no checkpointed principal\n  ///      at the snapshot prices to zero and is rejected.\n  function expressVote(uint256 _proposalId, uint8 _support, bytes calldata _params, string calldata _reason) external;\n\n  /// @notice Hands `_amount` of `_token` to the calling entrypoint for swapping; the swap output\n  ///         must land back on the Relay.\n  /// @param _token Reward token to pull out to the entrypoint.\n  /// @param _amount Amount to transfer to the caller.\n  /// @dev Gated to either entrypoint role. Bounded to the un-accounted balance, so an entrypoint\n  ///      can never pull reward tokens already owed to claimants.\n  function pull(address _token, uint256 _amount) external;\n\n  /// @notice Appreciation lane: stakes `_amount` of TOKEN held by the Relay, minus the rake, into\n  ///         the Relay sAERO, raising the backing without minting shares.\n  /// @param _amount Gross TOKEN amount; the rake comes out of it.\n  /// @dev Bounded to the un-accounted TOKEN, so it can never stake TOKEN already owed to claimants.\n  ///      With tape recording enabled, too little gas left for the record reverts\n  ///      (`IRelayFactory.InsufficientGasForCall`), so an estimator prices the call to record rather\n  ///      than to skip; a tape that fails on its own is still swallowed by the factory.\n  function compound(uint256 _amount) external;\n\n  /// @notice Moves this Relay onto another VoterPaymentsModule.\n  /// @param _vpm The module to move to; it must be one the escrow currently authorizes.\n  function setVoterPaymentsModule(IVoterPaymentsModule _vpm) external;\n\n  /// @notice Points this Relay at another Governor, naming the adapter that speaks its dialect.\n  ///         The slice math and the consumption ledger stay on the Relay; only the snapshot read\n  ///         and the cast encoding go through the adapter.\n  /// @param _governor The Governor every later `expressVote` casts into.\n  /// @param _voteAdapter The adapter translating casts for it; both must be non-zero.\n  function setGovernor(IGovernor _governor, IRelayVoteAdapter _voteAdapter) external;\n\n  /// @notice Registers a reward token so the accumulator settles it. Maxi/L1 lock the registry\n  ///         after the first token; L2 grows it up to `MAX_REWARD_TOKENS`.\n  /// @param _token Reward token to add to the registry.\n  /// @dev Late registration needs no bootstrapping: index and checkpoints default to zero, so the\n  ///      first `notifyReward` accrues proportionally to current holders.\n  function addRewardToken(address _token) external;\n\n  /// @notice Drops a reward token that never distributed anything, reopening its registry slot.\n  /// @param _token Reward token to drop.\n  /// @dev The undo of a misregistration, and the only way back on the single-slot tiers, where the\n  ///      first token otherwise closes the registry for good. A token that ever paid stays: the\n  ///      accumulator settles and claims only registered tokens, so dropping it would freeze the\n  ///      rights it left behind.\n  function removeRewardToken(address _token) external;\n\n  /// @notice Proposes the recipient that fee/incentive claims for `_chainId` land at on that chain.\n  /// @param _chainId Leaf chain the recipient applies to; the Relay's own chain is rejected, since\n  ///        its claims always pay the Relay itself.\n  /// @param _recipient Address claims for that chain would be sent to; zero is rejected, since\n  ///        disabling a chain is `clearLeafRecipient` and needs no delay.\n  /// @dev Pointing claims at a new address hands reward custody to it, the same economic move as\n  ///      attaching an entrypoint, so it waits out the same delay. Claims keep resolving to the\n  ///      current recipient meanwhile, and the claim wrapper is permissionless, so anyone can move\n  ///      the outstanding accrual to the current custody before a proposal lands. One live proposal\n  ///      per chain: proposing again replaces it and restarts the delay.\n  function proposeLeafRecipient(uint256 _chainId, address _recipient) external;\n\n  /// @notice Lands the proposed recipient for `_chainId` once its timelock has elapsed.\n  /// @param _chainId Leaf chain whose proposal is executed.\n  function executeLeafRecipient(uint256 _chainId) external;\n\n  /// @notice Disables Relay-orchestrated claims for `_chainId`.\n  /// @param _chainId Leaf chain to disable.\n  /// @dev Immediate, with no delay: it only removes a capability, so a compromised transport is cut\n  ///      off at once. A proposal pending for the chain stays; `cancelLeafRecipient` drops it. It\n  ///      only closes the `claimRewards` route: an operator seated on the chain keeps claiming there\n  ///      on its own, and leaves through `revokeOperator`.\n  function clearLeafRecipient(uint256 _chainId) external;\n\n  /// @notice Cancels the leaf recipient proposal pending for `_chainId`, if any.\n  /// @param _chainId Leaf chain whose proposal is dropped.\n  /// @dev The current recipient stays, so claims keep working.\n  function cancelLeafRecipient(uint256 _chainId) external;\n\n  /// @notice Proposes the operator of the Relay's sAERO on `_chainId`.\n  /// @param _chainId Leaf chain the operator would act on.\n  /// @param _operator Address proposed as operator; zero is rejected, since clearing the seat is\n  ///        `revokeOperator` and needs no delay.\n  /// @dev An operator can call `claimRewards` on the leaf naming any recipient it likes, and on its\n  ///      own schedule. Naming one therefore hands over the same reward custody `leafRecipient`\n  ///      does, by a route that does not read `leafRecipient` at all, so it waits out the same\n  ///      delay. Without it the delay on `leafRecipient` would be worth nothing: an owner could\n  ///      seat an operator instead and take the same value immediately. The seat is not only\n  ///      claims: on a leaf where governance enabled local voting, the operator can also\n  ///      redistribute the Relay's gauge allocations (`LeafVoter.allocateGauges`). One live\n  ///      proposal per chain: proposing again replaces it and restarts the delay.\n  function proposeOperator(uint256 _chainId, address _operator) external;\n\n  /// @notice Sends the proposed operator for `_chainId` to that chain, once its timelock elapsed.\n  /// @param _chainId Leaf chain whose proposal is executed.\n  /// @param _gasLimit Destination gas budget for the leaf call.\n  /// @param _refundRecipient Address that receives unused dispatch value.\n  /// @dev Payable: the Voter charges for the cross-chain message, paid from `msg.value`.\n  function executeOperator(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Clears the operator on `_chainId` and cancels any proposal pending for it.\n  /// @param _chainId Leaf chain to clear the seat on.\n  /// @param _gasLimit Destination gas budget for the leaf call.\n  /// @param _refundRecipient Address that receives unused dispatch value.\n  /// @dev No delay, since it only removes a capability. It reaches the seat through the Voter, so\n  ///      it carries the Voter's own limits: it reverts on `CHAIN0`, on an unregistered chain, and\n  ///      on a `Paused` one. A paused chain is the gap worth knowing about, because the leaf keeps\n  ///      honouring the seated operator while it lasts: `LeafVoter.claimRewards` has no chain-status\n  ///      gate. Cancelling the proposal still works there, through `cancelOperator`; emptying the\n  ///      seat has to wait for the chain to leave `Paused`.\n  function revokeOperator(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Cancels the operator proposal pending for `_chainId`, if any.\n  /// @param _chainId Leaf chain whose proposal is dropped.\n  /// @dev Root-only and free: it touches no chain state and sends no message, so it works whatever\n  ///      the Voter thinks of the chain. That is the point. `revokeOperator` also drops the\n  ///      proposal, but it reverts with the dispatch, so it cannot cancel one aimed at a chain the\n  ///      Voter refuses to message. Without this path such a proposal would sit there forever, and\n  ///      one named for `CHAIN0` could never be executed nor removed.\n  function cancelOperator(uint256 _chainId) external;\n\n  /// @notice Replaces the Relay's display name, read by frontends and analytics.\n  /// @param _name The new name.\n  /// @dev Not the ERC-20 `name()` of either satellite token; those are fixed at initialization and\n  ///      a rename leaves them untouched. They must stay fixed: Solady builds the EIP-712 domain\n  ///      from `name()`, so a moved name would void every unspent `permit` and delegation signature.\n  function setName(string calldata _name) external;\n\n  /// @notice Accumulator lane: distributes `_amount` of `_token`, minus the rake, to all current\n  ///         holders by advancing its per-share index.\n  /// @param _token Reward token being distributed.\n  /// @param _amount Gross batch; the rake comes out of it.\n  /// @dev `_amount` cannot exceed the un-accounted balance that actually arrived. Reverts on an\n  ///      unregistered token or zero supply. With tape recording enabled, too little gas left for\n  ///      the record reverts as well (`IRelayFactory.InsufficientGasForCall`), so an estimator\n  ///      prices the call to record rather than to skip; a tape that fails on its own is still\n  ///      swallowed by the factory.\n  function notifyReward(address _token, uint256 _amount) external;\n\n  /// @notice Pays out the caller's accrued reward in `_token` to `_to`, without burning shares.\n  /// @dev Each settle rounds the holder's credit down to the token's smallest unit. The remainder stays\n  ///      in `accountedBalance` with no owner. A settle runs on every yield-token balance change. A third\n  ///      party can trigger one with a transfer to the holder, or with a deposit to the holder while the\n  ///      Relay is open.\n  /// @param _token Reward token to claim.\n  /// @param _to Recipient of the payout.\n  /// @return _amount Reward amount transferred.\n  function claim(address _token, address _to) external returns (uint256 _amount);\n\n  /// @notice Claims the Relay's accrued fee and incentive rewards for `_chainId` to the recipient\n  ///         configured for that chain, funding the dispatch with msg.value. Permissionless\n  ///         pass-through to the Voter.\n  /// @param _chainId Chain to claim rewards on: the local chain for a root claim, a leaf otherwise.\n  /// @param _gasLimit Destination gas budget for the leaf claim dispatch (ignored on a root claim).\n  /// @param _feeClaims Fee claim requests forwarded to the Voter; the keeper picks and sizes them.\n  /// @param _incentiveClaims Incentive claim requests forwarded to the Voter; the keeper picks and\n  ///        sizes them.\n  /// @dev The recipient is read from per-chain config, never from the caller, so a caller can only\n  ///      fund and trigger. A root claim must carry zero value.\n  function claimRewards(\n    uint256 _chainId,\n    uint256 _gasLimit,\n    ILeafVoter.FeeClaim[] calldata _feeClaims,\n    ILeafVoter.IncentiveClaim[] calldata _incentiveClaims\n  ) external payable;\n\n  /// @notice Seats or removes a RAKE_MANAGER.\n  /// @param _account Address whose RAKE_MANAGER role changes.\n  /// @param _enabled True to seat, false to remove.\n  function setRakeManager(address _account, bool _enabled) external;\n\n  /// @notice Hands the RAKE_MANAGER_ADMIN seat to a successor, named by the sitting admin.\n  /// @param _newAdmin Address receiving the seat.\n  function transferRakeManagerAdmin(address _newAdmin) external;\n\n  /// @notice Proposes rake rates; a raise waits out `entrypointTimelock`, a cut applies at once.\n  /// @param _protocolPips Protocol rake, at most `MAX_RAKE_PIPS`.\n  /// @param _allocatorPips Allocator rake, at most `MAX_RAKE_PIPS`.\n  function proposeRakes(uint256 _protocolPips, uint256 _allocatorPips) external;\n\n  /// @notice Applies the pending rake pair once its timelock has elapsed.\n  function executeRakes() external;\n\n  /// @notice Sends the protocol lane of each token to the factory's rake treasury. Permissionless.\n  /// @param _tokens Tokens to collect; a token with nothing accrued is skipped.\n  function collectProtocolFees(address[] calldata _tokens) external;\n\n  /// @notice Sends the allocator lane of each token to `_recipient`.\n  /// @param _tokens Tokens to collect; a token with nothing accrued is skipped.\n  /// @param _recipient Non-zero recipient of the fees.\n  function collectAllocatorFees(address[] calldata _tokens, address _recipient) external;\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                  VIEW FUNCTIONS                                    __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Total reward in `_token` claimable by `_holder` right now: settled pending plus the\n  ///         not-yet-settled accrual since their last checkpoint.\n  /// @param _holder Holder to price.\n  /// @param _token Reward token to price.\n  /// @return _amount Claimable reward amount.\n  function claimable(address _holder, address _token) external view returns (uint256 _amount);\n\n  /// @notice Whether `_token` is in the reward registry (gates `notifyReward` and `claim`).\n  /// @param _token Token to check.\n  /// @return _registered True when the token is registered.\n  function isRewardToken(address _token) external view returns (bool _registered);\n\n  /// @notice The registered reward tokens, in registration order.\n  /// @return _tokens The reward-token registry as an array.\n  function rewardTokens() external view returns (address[] memory _tokens);\n\n  /// @notice The Relay tier, for on-chain discovery. Implemented by each concrete subclass.\n  /// @return _relayType The tier (Maxi, ProtocolL1 or ProtocolL2).\n  function relayType() external view returns (RelayType _relayType);\n\n  /// @notice The Relay's configuration block (tokenId, minimums, queue limits, caps, name/symbol).\n  /// @return _config The full configuration struct.\n  function relayConfig() external view returns (RelayConfig memory _config);\n\n  /// @notice The rake rates and the pending rate change.\n  /// @return _rakes The rake state.\n  function rakes() external view returns (RakeState memory _rakes);\n\n  /// @notice Withdraw destination sentinel: route the weight to a freshly minted sAERO.\n  /// @return _sentinel The mint sentinel value.\n  function MINT_SENTINEL() external view returns (uint256 _sentinel);\n\n  /// @notice Hard cap on the reward-token registry, bounding the per-transfer settle loop's gas.\n  /// @return _max The maximum number of registered reward tokens (10).\n  function MAX_REWARD_TOKENS() external view returns (uint256 _max);\n\n  /// @notice Fixed-point scaling factor for the per-share reward accumulator.\n  /// @return _scale The accumulator scaling factor (1e27).\n  /// @dev Each notify leaves under `yieldToken.totalSupply() / ACC_SCALE` raw units un-accounted for\n  ///      the next batch. This scale keeps that below one unit at any realistic supply, also for a\n  ///      reward token with few decimals. The cost is a ceiling of `2^256 / ACC_SCALE` on one notify.\n  function ACC_SCALE() external view returns (uint256 _scale);\n\n  /// @notice VotingEscrow that custodies the staked TOKEN; weight only moves through the VPM.\n  /// @return _votingEscrow The VotingEscrow contract.\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /// @notice Voter that owns allocation, the vote cooldown and cross-chain dispatch.\n  /// @return _voter The Voter contract.\n  function VOTER() external view returns (IVoter _voter);\n\n  /// @notice The underlying protocol TOKEN staked behind the sAERO, read from VotingEscrow.\n  /// @return _token The protocol TOKEN address.\n  function TOKEN() external view returns (address _token);\n\n  /// @notice Implementation cloned as the principal token (PT): a checkpointed RelayToken\n  ///         (`RelayTokenVotes`), so governance can price a holder's weight at a past timepoint.\n  /// @return _implementation The principal-token implementation address.\n  function PRINCIPAL_TOKEN_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice Implementation cloned as the yield token (YT): the plain RelayToken, no checkpoints.\n  /// @return _implementation The yield-token implementation address.\n  function YIELD_TOKEN_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice Wrapped native token every native inflow is wrapped into.\n  /// @return _wrappedNative The wrapped native token address.\n  function WRAPPED_NATIVE() external view returns (address _wrappedNative);\n\n  /// @notice Ceiling of each rake rate, in pips.\n  /// @return _maxRakePips The rake ceiling.\n  function MAX_RAKE_PIPS() external view returns (uint256 _maxRakePips);\n\n  /// @notice Factory that initialized this Relay; it names the rake treasury.\n  /// @return _factory The factory address.\n  function factory() external view returns (address _factory);\n\n  /// @notice The principal token (PT): the priced position carrying the withdraw right.\n  /// @return _principalToken The principal token clone.\n  function principalToken() external view returns (IRelayToken _principalToken);\n\n  /// @notice The yield token (YT): the balance the reward accumulator reads.\n  /// @return _yieldToken The yield token clone.\n  function yieldToken() external view returns (IRelayToken _yieldToken);\n\n  /// @notice Deposit-queue entries by id: async deposits that wait for processing. A consumed\n  ///         entry is deleted, so it reads back as all zeroes; the history lives in the events.\n  /// @param _id Deposit-queue id to read.\n  /// @return _recipient Address the shares mint to, named at request.\n  /// @return _requestedAt Timestamp the deposit was requested; zero once the entry is consumed.\n  /// @return _tokenId Source sAERO of the pending deposit.\n  /// @return _amount Staking weight queued by the deposit.\n  function pendingDeposits(uint256 _id)\n    external\n    view\n    returns (address _recipient, uint48 _requestedAt, uint128 _tokenId, uint128 _amount);\n\n  /// @notice Bookkeeping of the deposit queue (see `DenseQueue.Queue`).\n  /// @return _head Earliest id the walk must still visit (possibly a consumed entry), or zero.\n  /// @return _tail Last issued id, or zero while no request was made.\n  /// @return _count Outstanding (live) entries.\n  function depositList() external view returns (uint40 _head, uint40 _tail, uint40 _count);\n\n  /// @notice TOKEN-denominated weight backing the current shares: admitted deposits plus compounds\n  ///         minus withdrawals. An internal counter, never read from `balanceOf` or `VE.staked()`,\n  ///         so a donation cannot inflate the share price.\n  /// @return _backing The current backing counter.\n  function totalBacking() external view returns (uint256 _backing);\n\n  /// @notice VoterPaymentsModule this Relay currently moves weight through; movable because the\n  ///         module the Relay started on can lose its escrow authorization.\n  /// @return _vpm The VoterPaymentsModule contract.\n  function vpm() external view returns (IVoterPaymentsModule _vpm);\n\n  /// @notice Governor `expressVote` casts into. Set at initialization, movable through `setGovernor`.\n  /// @return _governor The Governor contract.\n  function governor() external view returns (IGovernor _governor);\n\n  /// @notice Adapter translating casts into the Governor's dialect, consulted by STATICCALL only.\n  ///         Set at initialization, movable through `setGovernor`.\n  /// @return _voteAdapter The vote adapter.\n  function voteAdapter() external view returns (IRelayVoteAdapter _voteAdapter);\n\n  /// @notice Reward-token balance already notified into the accumulator and not yet claimed, plus\n  ///         the uncollected rake; the un-accounted remainder is all notify/compound may spend.\n  ///         Invariant: `balanceOf(token) >= accountedBalance[token]`.\n  /// @param _token Token to read.\n  /// @return _accounted The accounted balance for the token.\n  function accountedBalance(address _token) external view returns (uint256 _accounted);\n\n  /// @notice Per-token accumulator: reward-per-share scaled by ACC_SCALE, advanced by `notifyReward`.\n  /// @param _token Token to read.\n  /// @return _index The per-share accumulator for the token.\n  function rewardIndex(address _token) external view returns (uint256 _index);\n\n  /// @notice Per-(holder, token) snapshot of `rewardIndex` at the holder's last settle.\n  /// @param _holder Holder to read.\n  /// @param _token Token to read.\n  /// @return _checkpoint The holder's last-settled index for the token.\n  function userCheckpoint(address _holder, address _token) external view returns (uint256 _checkpoint);\n\n  /// @notice Per-(holder, token) reward settled into a claimable balance but not yet claimed.\n  /// @param _holder Holder to read.\n  /// @param _token Token to read.\n  /// @return _pending The holder's settled, unclaimed reward for the token.\n  function pendingReward(address _holder, address _token) external view returns (uint256 _pending);\n\n  /// @notice Registered exits awaiting drain, stored by id. A settled exit is deleted, so it reads\n  ///         back as all zeroes; the history lives in the events.\n  /// @param _id Withdraw-queue id to read.\n  /// @return _holder Owner of the escrowed shares for the entry.\n  /// @return _registeredAt Registration timestamp anchoring the evacuation clock.\n  /// @return _shares Shares escrowed by the entry.\n  /// @return _destination Registered destination sAERO, or `MINT_SENTINEL` when the exit mints a fresh\n  ///         one. The drain can still fall back to a fresh sAERO (see `processWithdrawals`).\n  function withdrawals(uint256 _id)\n    external\n    view\n    returns (address _holder, uint48 _registeredAt, uint256 _shares, uint256 _destination);\n\n  /// @notice Bookkeeping of the withdraw queue (see `DenseQueue.Queue`).\n  /// @return _head Id of the oldest exit that still waits, or zero when the queue is drained.\n  /// @return _tail Last issued id, or zero while no exit was ever registered.\n  /// @return _count Outstanding (undrained) exits.\n  function withdrawQueue() external view returns (uint40 _head, uint40 _tail, uint40 _count);\n\n  /// @notice Total shares escrowed across all queued withdrawals not yet drained; the drain\n  ///         settles these against the idle chain0 weight.\n  /// @return _shares The escrowed, undrained share total.\n  function pendingWithdrawalShares() external view returns (uint256 _shares);\n\n  /// @notice Shares each holder has locked into the withdraw queue: still on the holder's balances,\n  ///         accruing rewards until burned, but locked in place. One counter locks the PT/YT pair\n  ///         in equal units.\n  /// @param _holder Holder to read.\n  /// @return _shares The holder's escrowed (queued, undrained) share amount.\n  function escrowedShares(address _holder) external view returns (uint256 _shares);\n\n  /// @notice Whether the Relay is permanently closed. A closed Relay only winds down: no new\n  ///         allocations, no new deposit requests; exits keep settling as returns land.\n  /// @return _closed True once the Relay has been closed.\n  function closed() external view returns (bool _closed);\n\n  /// @notice Per-leaf-chain recipient that fee/incentive claims land at on that chain. Zero\n  ///         disables Relay-orchestrated claims for the chain; a seated operator claims regardless.\n  /// @param _chainId Leaf chain to read.\n  /// @return _recipient The configured claim recipient for the chain (zero when unset).\n  function leafRecipient(uint256 _chainId) external view returns (address _recipient);\n\n  /// @notice Recipient proposed for a leaf chain, waiting out its timelock. Zero recipient means\n  ///         nothing is pending.\n  /// @param _chainId Leaf chain to read.\n  /// @return _recipient The proposed claim recipient.\n  /// @return _proposedAt Timestamp the proposal was stamped.\n  function pendingLeafRecipient(uint256 _chainId) external view returns (address _recipient, uint48 _proposedAt);\n\n  /// @notice The operator proposal pending for a leaf chain, if any.\n  /// @param _chainId Leaf chain to read.\n  /// @return _operator Address proposed as operator; zero when nothing is pending.\n  /// @return _proposedAt Timestamp the proposal was stamped.\n  function pendingOperator(uint256 _chainId) external view returns (address _operator, uint48 _proposedAt);\n\n  /// @notice Governance weight each holder has already spent on a proposal, bounded by their\n  ///         snapshot slice. Lives here rather than in the governance library, so relinking it\n  ///         cannot reset what a holder spent. Keyed by Governor: proposal ids hash the proposal's\n  ///         actions and not the Governor's address, so a rotation could otherwise inherit a\n  ///         colliding id's consumption.\n  /// @param _governor Governor the spend was booked against.\n  /// @param _proposalId Proposal to read.\n  /// @param _holder Holder to read.\n  /// @return _used Weight already consumed from the holder's slice for the proposal.\n  function usedGovernanceWeight(\n    address _governor,\n    uint256 _proposalId,\n    address _holder\n  ) external view returns (uint256 _used);\n\n  /// @notice Rake accrued in a token and not yet collected, held inside `accountedBalance`.\n  /// @param _token Token to read.\n  /// @return _protocol Protocol lane.\n  /// @return _allocator Allocator lane.\n  function feeAccrued(address _token) external view returns (uint128 _protocol, uint128 _allocator);\n}\n"},"V3/src/interfaces/relay/IRelayFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IGovernor} from 'V3/interfaces/governor/IGovernor.sol';\nimport {IRelay} from 'V3/interfaces/relay/IRelay.sol';\nimport {IRelayVoteAdapter} from 'V3/interfaces/relay/IRelayVoteAdapter.sol';\nimport {IVoterPaymentsModule} from 'V3/interfaces/vpm/IVoterPaymentsModule.sol';\n\n/// @title  IRelayFactory\n/// @notice Creates Maxi and Protocol Relays as deterministic EIP-1167 minimal proxies over\n///         per-tier implementations. Each create call seeds a fresh sAERO with the initial\n///         deposit, transfers it to the clone's predicted address, then clones and initializes the\n///         Relay there — so initialization finds the sAERO already bound. Creation is restricted to\n///         RELAY_DEPLOYER_ROLE on the Voter; using a Relay is governed by the Relay's own tier.\ninterface IRelayFactory {\n  /// @notice Inputs to create a Relay. The protocol dependencies (VotingEscrow/VPM/Voter) are factory\n  ///         immutables, so they are not repeated here.\n  /// @param admin Initial owner: it holds the admin gates and manages every role bit.\n  /// @param keeper Initial KEEPER operator.\n  /// @param voter Initial VOTER_ROLE operator granted at deploy, or zero to skip; the owner can grant\n  ///        or rotate it later.\n  /// @param compounder Entrypoint granted COMPOUNDER at deploy, or zero to skip. Must be bound to\n  ///        the new Relay (see `predictRelay`).\n  /// @param converter Entrypoint granted CONVERTER at deploy, or zero to skip (same address as\n  ///        `compounder` for a Hybrid). Must be bound to the new Relay.\n  /// @param bootstrapOwner Recipient of the bootstrap shares minted 1:1 against the seed stake at\n  ///        initialization (genesis price/share is exactly 1, so the seed is not gifted to the first\n  ///        depositor). Must be non-zero; allow-listed at genesis on whitelist-gated tiers.\n  /// @param rewardToken First reward token to register at initialization, or zero to leave the registry\n  ///        empty for KEEPER. The registry never drops a token and the single-slot tiers close on the\n  ///        first one, so naming it here pins it in the same call that names the entrypoints.\n  /// @param entrypointVetoer Holder of ENTRYPOINT_VETOER on the Protocol tiers, or zero to run the\n  ///        entrypoint timelock without a veto. The public role paths refuse the bit, so an empty\n  ///        seat can never be filled afterwards; other tiers ignore this field.\n  /// @param rakeManagerAdmin Non-zero holder of RAKE_MANAGER_ADMIN.\n  /// @param protocolRakePips Genesis protocol rake, at most the tier's `MAX_RAKE_PIPS`.\n  /// @param allocatorRakePips Genesis allocator rake, at most the tier's `MAX_RAKE_PIPS`.\n  /// @param seedAmount Initial TOKEN staked into the Relay sAERO; pulled from the caller. A uint128,\n  ///        matching VotingEscrow's stake amount, so no narrowing happens at stake time. A seed below\n  ///        `MIN_STAKE_AMOUNT` is rejected downstream, where `initialize` re-checks the staked seed\n  ///        (the first-depositor inflation guard).\n  /// @param isPermanent Whether the seed stake is permanent (true) or time-locked.\n  /// @param ytTransferable True to deploy the yield token transferable; false makes it soulbound.\n  ///        Immutable switch on the YT clone; tiers with an allow list reject true.\n  /// @param stakingWeeks Lock length in weeks for a time-locked stake; must be zero when permanent.\n  /// @param salt Caller-chosen salt deriving the clone's deterministic address. Hashed together\n  ///        with the caller, so another account cannot occupy it; reusing a (caller, salt) pair on\n  ///        the same tier reverts.\n  /// @param config Relay configuration; its `tokenId` is overwritten with the freshly minted sAERO.\n  ///        Its `entrypointTimelock` delays every timelocked change on the Relay, rake raises included.\n  struct CreateParams {\n    address admin;\n    address keeper;\n    address voter;\n    address compounder;\n    address converter;\n    address bootstrapOwner;\n    address rewardToken;\n    address entrypointVetoer;\n    address rakeManagerAdmin;\n    uint256 protocolRakePips;\n    uint256 allocatorRakePips;\n    uint128 seedAmount;\n    bool isPermanent;\n    bool ytTransferable;\n    uint48 stakingWeeks;\n    bytes32 salt;\n    IRelay.RelayConfig config;\n  }\n\n  /// @notice The entrypoints a Relay was created with.\n  /// @param compounder Entrypoint granted COMPOUNDER at creation, or zero.\n  /// @param converter Entrypoint granted CONVERTER at creation, or zero.\n  struct InitialEntrypoints {\n    address compounder;\n    address converter;\n  }\n\n  /// @notice Emitted when a Relay is created.\n  /// @param relay The deployed Relay address.\n  /// @param tokenId The sAERO minted and bound to the Relay.\n  /// @param relayType The tier of the created Relay.\n  /// @param compounder Entrypoint granted COMPOUNDER at creation, or zero.\n  /// @param converter Entrypoint granted CONVERTER at creation, or zero.\n  event RelayCreated(\n    address indexed relay, uint256 indexed tokenId, IRelay.RelayType relayType, address compounder, address converter\n  );\n\n  /// @notice Emitted when the rake treasury changes.\n  /// @param treasury Address every Relay's protocol fees are collected to from here on.\n  event RakeTreasurySet(address indexed treasury);\n\n  /// @notice Emitted when the relay tape and its call gas limit are set.\n  /// @param tape The tape observations are relayed to, or zero to stop recording.\n  /// @param gasLimit Gas forwarded to each tape call.\n  event RelayTapeSet(address indexed tape, uint32 gasLimit);\n\n  /// @notice Thrown when a zero address is supplied for a protocol dependency.\n  error ZeroAddress();\n\n  /// @notice Thrown when the caller lacks the Voter role the call requires.\n  error NotAuthorized();\n\n  /// @notice Thrown when a tier implementation address holds no code, which would clone an inert\n  ///         Relay and strand the seed sAERO transferred to its predicted address.\n  error ImplementationNotAContract();\n\n  /// @notice Thrown when a created Relay comes out of `initialize` with no satellite tokens, the\n  ///         signature of a clone whose body never ran.\n  error RelayInitializationFailed();\n\n  /// @notice Thrown when a named entrypoint is bound to a different Relay.\n  error EntrypointNotBound();\n\n  /// @notice Thrown when the relay tape gas limit is set to zero.\n  error ZeroGasLimit();\n\n  /// @notice Thrown when the gas left cannot cover the configured tape call.\n  error InsufficientGasForCall();\n\n  /// @notice Creates a Maxi Relay: deposits into it are permissionless, creating it is not.\n  /// @param _params Creation inputs.\n  /// @return _relay The deployed Relay address.\n  /// @return _tokenId The sAERO bound to the Relay.\n  /// @dev Restricted to RELAY_DEPLOYER_ROLE: the gate says who may run a Maxi, not who may use one.\n  function createMaxiRelay(CreateParams calldata _params) external returns (address _relay, uint256 _tokenId);\n\n  /// @notice Creates a Protocol Relay, starting as L1 or directly as L2.\n  /// @param _params Creation inputs.\n  /// @param _startAsLevel2 True to deploy directly as Protocol L2; false to start as L1.\n  /// @return _relay The deployed Relay address.\n  /// @return _tokenId The sAERO bound to the Relay.\n  /// @dev Restricted to RELAY_DEPLOYER_ROLE, which is what makes `_startAsLevel2` safe to take from\n  ///      the caller.\n  function createProtocolRelay(\n    CreateParams calldata _params,\n    bool _startAsLevel2\n  ) external returns (address _relay, uint256 _tokenId);\n\n  /// @notice Sets the rake treasury. Restricted to GOVERNANCE_ROLE on the Voter.\n  /// @param _treasury Non-zero address every Relay's protocol fees are collected to.\n  function setRakeTreasury(address _treasury) external;\n\n  /// @notice Relays a reward distribution to the tape, fail-open towards the tape.\n  /// @dev Callable by anything, effectful only for relays this factory created: anything else\n  ///      returns silently, as does an unset tape. The tape call is capped at the configured gas and\n  ///      its revert is swallowed, so a broken tape can never block the distribution that reports it.\n  ///      Too little gas for that call is the one failure that does reach the reporter, so a starved\n  ///      transaction reverts rather than recording nothing in silence, which is what lets an\n  ///      estimator price a recording operation. That holds as long as the configured gas exceeds\n  ///      what a record costs by the 63/64 the call forwards: under a limit sized too tightly, a\n  ///      record that runs out is swallowed like any other tape failure. The values travel with the\n  ///      report because the reporter holds them exact at the moment of truth, sparing the tape every\n  ///      read back into the relay.\n  /// @param _token The reward token distributed.\n  /// @param _distributed The amount distributed to holders, post rake.\n  /// @param _index The relay's per-share index after the advance.\n  function recordRewardTape(address _token, uint256 _distributed, uint256 _index) external;\n\n  /// @notice Relays a compound to the tape, fail-open towards the tape.\n  /// @dev Same contract as `recordRewardTape`.\n  /// @param _net The amount staked into backing, post rake.\n  /// @param _backing The relay's backing after the compound lands.\n  /// @param _supply The principal supply that backing prices against.\n  function recordBackingTape(uint256 _net, uint256 _backing, uint256 _supply) external;\n\n  /// @notice Sets the relay tape and the gas forwarded to each tape call.\n  /// @dev Zero tape stops recording; the gas limit must stay nonzero so a set tape is never starved.\n  ///      With a tape set, the limit is a floor every compound and notify has to clear, so one set\n  ///      beyond what a transaction can carry halts those flows on every relay of this factory until\n  ///      governance lowers it again.\n  /// @param _relayTape The tape to relay observations to, or zero to stop recording.\n  /// @param _gasLimit Gas forwarded to each tape call.\n  function setRelayTape(address _relayTape, uint32 _gasLimit) external;\n\n  /// @notice The address a Relay will be created at.\n  /// @param _deployer Account that will call the create function.\n  /// @param _salt Salt it will pass in `CreateParams`.\n  /// @param _relayType Tier it will create; both Protocol types share one implementation.\n  /// @return _relay The predicted Relay address.\n  /// @dev Entrypoints of a Maxi or L1 Relay are deployed against this address before the Relay exists.\n  function predictRelay(\n    address _deployer,\n    bytes32 _salt,\n    IRelay.RelayType _relayType\n  ) external view returns (address _relay);\n\n  /// @notice Whether an address is a Relay this factory created.\n  /// @param _relay Address to check.\n  /// @return _created True when this factory created `_relay`.\n  /// @dev The membership check for consumers that gate a privileged path on being a Relay (the\n  ///      MetaRouter reads it). Answers in one storage read. Because creation is role-gated, a true\n  ///      answer means an authorized deployer created it.\n  function isRelay(address _relay) external view returns (bool _created);\n\n  /// @notice The entrypoints a Relay this factory created was initialized with.\n  /// @param _relay Relay to read.\n  /// @return _compounder Entrypoint granted COMPOUNDER at creation, or zero.\n  /// @return _converter Entrypoint granted CONVERTER at creation, or zero.\n  /// @dev A Maxi Relay can never change them, so for it this is the current pair. A Protocol Relay\n  ///      can change them once it is L2, so read its roles for the current ones.\n  function initialEntrypoints(address _relay) external view returns (address _compounder, address _converter);\n\n  /// @notice The number of Relays this factory has created.\n  /// @return _length The total count, which only ever grows.\n  function allRelaysLength() external view returns (uint256 _length);\n\n  /// @notice A page of created Relays, in creation order.\n  /// @param _start First index to read, inclusive.\n  /// @param _end Index to stop at, exclusive.\n  /// @return _relays The Relays in that range.\n  /// @dev Out-of-range input is clamped rather than rejected, so a caller can walk fixed-size pages\n  ///      off the end without checking the length first.\n  function allRelays(uint256 _start, uint256 _end) external view returns (address[] memory _relays);\n\n  /// @notice The VotingEscrow every Relay this factory creates binds to; also mints the seed sAERO.\n  /// @return _votingEscrow The VotingEscrow contract.\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /// @notice The underlying protocol TOKEN, read from VotingEscrow; pulled from callers to seed stakes.\n  /// @return _token The protocol TOKEN address.\n  function TOKEN() external view returns (address _token);\n\n  /// @notice The Voter whose role registry says who may create Relays here.\n  /// @return _voter The Voter address.\n  function VOTER() external view returns (address _voter);\n\n  /// @notice MaxiRelay implementation every Maxi clone delegates to.\n  /// @return _implementation The implementation address.\n  function MAXI_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice ProtocolRelay implementation every Protocol clone delegates to.\n  /// @return _implementation The implementation address.\n  function PROTOCOL_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice VoterPaymentsModule every created Relay starts on.\n  /// @return _vpm The VoterPaymentsModule contract.\n  function VPM() external view returns (IVoterPaymentsModule _vpm);\n\n  /// @notice Governor every created Relay starts casting into.\n  /// @return _governor The Governor contract.\n  function GOVERNOR() external view returns (IGovernor _governor);\n\n  /// @notice Adapter every created Relay's casts start encoded by.\n  /// @return _voteAdapter The vote adapter contract.\n  function VOTE_ADAPTER() external view returns (IRelayVoteAdapter _voteAdapter);\n\n  /// @notice Recipient of every Relay's protocol fees.\n  /// @return _treasury The rake treasury address.\n  function rakeTreasury() external view returns (address _treasury);\n\n  /// @notice The tape observations are relayed to, or zero when recording is off.\n  /// @return _tape The configured relay tape.\n  function relayTape() external view returns (address _tape);\n\n  /// @notice Gas forwarded to each tape call.\n  /// @return _gasLimit The configured per-call gas.\n  function relayTapeGasLimit() external view returns (uint32 _gasLimit);\n}\n"},"V3/src/interfaces/relay/IRelayState.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IRelay} from 'V3/interfaces/relay/IRelay.sol';\nimport {IRelayToken} from 'V3/interfaces/relay/IRelayToken.sol';\n\n/**\n * @title  IRelayState\n * @notice The part of the Relay's own external interface that its libraries read back through\n *         self-calls.\n */\ninterface IRelayState {\n  /// @notice The VotingEscrow holding the Relay's stake, whose staked amount is the upper bound of\n  ///         what the queue can be owed.\n  /// @return The escrow.\n  function VOTING_ESCROW() external view returns (IVotingEscrow);\n\n  /// @notice The protocol TOKEN staked behind the Relay's sAERO.\n  /// @return The protocol TOKEN address.\n  function TOKEN() external view returns (address);\n\n  /// @notice Checkpointed RelayToken implementation cloned as the principal token.\n  /// @return The principal-token implementation address.\n  function PRINCIPAL_TOKEN_IMPLEMENTATION() external view returns (address);\n\n  /// @notice Plain RelayToken implementation cloned as the yield token.\n  /// @return The yield-token implementation address.\n  function YIELD_TOKEN_IMPLEMENTATION() external view returns (address);\n\n  /// @notice The Relay's configuration block.\n  /// @return _config The full configuration struct.\n  function relayConfig() external view returns (IRelay.RelayConfig memory _config);\n\n  /// @notice The Relay's backing counter.\n  /// @return The current backing.\n  function totalBacking() external view returns (uint256);\n\n  /// @notice Shares escrowed across the queued, undrained withdrawals.\n  /// @return The escrowed-share total.\n  function pendingWithdrawalShares() external view returns (uint256);\n\n  /// @notice The Relay's principal token, whose supply prices the escrowed shares.\n  /// @return The principal token.\n  function principalToken() external view returns (IRelayToken);\n\n  /// @notice The Relay's yield token, banned from the reward registry along with the principal.\n  /// @return The yield token.\n  function yieldToken() external view returns (IRelayToken);\n\n  /// @notice Ceiling of each rake rate, in pips.\n  /// @return The rake ceiling.\n  function MAX_RAKE_PIPS() external view returns (uint256);\n\n  /// @notice Factory that initialized the Relay; it names the rake treasury.\n  /// @return The factory address.\n  function factory() external view returns (address);\n}\n"},"V3/src/interfaces/factories/IGaugeFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol';\n\ninterface IGaugeFactory is IAccessControl {\n  /**\n   * @notice Constructor wiring for a GaugeFactory.\n   * @param leafVoter The LeafVoter gauges authorize at runtime. The GaugeManager is read from it.\n   * @param votingRewardsFactory The VotingRewardsFactory deploying each gauge's VotingRewardsManager.\n   * @param isStable Whether the factory creates stable-pool gauges.\n   * @param capAdmin Initial CAP_ADMIN_ROLE holder.\n   * @param referralAdmin Initial REFERRAL_ADMIN_ROLE holder.\n   * @param penaltyAdmin Initial PENALTY_ADMIN_ROLE holder.\n   * @param capOperator Initial CAP_OPERATOR_ROLE holder.\n   * @param defaultCap Factory-wide default emission cap.\n   * @param operatorMinCap Minimum cap CAP_OPERATOR_ROLE may set.\n   * @param operatorMaxCap Maximum cap CAP_OPERATOR_ROLE may set.\n   * @param maxMinStakeBlocks Upper bound on per-gauge minimum staking period overrides.\n   * @param gaugeTapeManagerAdmin Initial `GAUGE_TAPE_MANAGER_ADMIN_ROLE` holder.\n   * @param gaugeTapeManager Initial `GAUGE_TAPE_MANAGER_ROLE` holder.\n   */\n  struct InitParams {\n    address leafVoter;\n    address votingRewardsFactory;\n    bool isStable;\n    address capAdmin;\n    address referralAdmin;\n    address penaltyAdmin;\n    address capOperator;\n    uint128 defaultCap;\n    uint128 operatorMinCap;\n    uint128 operatorMaxCap;\n    uint256 maxMinStakeBlocks;\n    address gaugeTapeManagerAdmin;\n    address gaugeTapeManager;\n  }\n\n  /**\n   * @notice Referral configuration for a gauge.\n   * @param referral Address receiving the referral share.\n   * @param share Referral share in PIPS.\n   */\n  struct ReferralConfig {\n    address referral;\n    uint256 share;\n  }\n\n  /**\n   * @notice Early unstake penalty configuration shared by gauges created by this factory.\n   * @param minStakeBlocks Factory-wide default minimum staking period in blocks.\n   * @param penaltyRate Penalty rate in PIPS. Zero disables the penalty.\n   */\n  struct PenaltyConfig {\n    uint256 minStakeBlocks;\n    uint256 penaltyRate;\n  }\n\n  /**\n   * @notice Emitted when a new gauge is deployed.\n   * @param _gauge Address of the deployed gauge.\n   * @param _pool Address of the pool or staking token.\n   * @param _isPool Whether the staking token is a V2 pool.\n   */\n  event GaugeCreated(address indexed _gauge, address indexed _pool, bool _isPool);\n\n  /**\n   * @notice Emitted when a gauge emission cap is updated.\n   * @param _gauge Address of the gauge.\n   * @param _cap Stored cap value written for the gauge.\n   * @param _caller Address that updated the cap.\n   */\n  event EmissionCapSet(address indexed _gauge, uint128 _cap, address indexed _caller);\n\n  /**\n   * @notice Emitted when fee flushing fails during forced gauge deactivation.\n   * @param _gauge Address of the gauge whose fee flush failed.\n   */\n  event FeeFlushFailed(address indexed _gauge);\n\n  /**\n   * @notice Emitted when the default cap is updated.\n   * @param _cap New default cap.\n   */\n  event DefaultCapSet(uint128 _cap);\n\n  /**\n   * @notice Emitted when the operator cap range is updated.\n   * @param _minCap New minimum cap allowed for operators.\n   * @param _maxCap New maximum cap allowed for operators.\n   */\n  event OperatorCapRangeSet(uint128 _minCap, uint128 _maxCap);\n\n  /**\n   * @notice Emitted when the maximum referral share cap is updated.\n   * @param _cap New maximum share cap in PIPS.\n   */\n  event MaxShareCapSet(uint256 _cap);\n\n  /**\n   * @notice Emitted when a gauge referral configuration is updated.\n   * @param _gauge Address of the gauge.\n   * @param _referral Address receiving the referral share.\n   * @param _share Referral share in PIPS.\n   */\n  event ReferralConfigSet(address indexed _gauge, address indexed _referral, uint256 _share);\n\n  /**\n   * @notice Emitted when the factory-wide penalty configuration is updated.\n   * @param _minStakeBlocks New factory-wide minimum staking period in blocks.\n   * @param _penaltyRate New penalty rate in PIPS.\n   */\n  event PenaltyConfigSet(uint256 _minStakeBlocks, uint256 _penaltyRate);\n\n  /**\n   * @notice Emitted when a gauge minimum staking period override is updated.\n   * @param _gauge Address of the gauge.\n   * @param _minStakeBlocks New per-gauge minimum staking period override in blocks.\n   */\n  event MinStakeBlocksSet(address indexed _gauge, uint256 _minStakeBlocks);\n\n  /**\n   * @notice Emitted when the gauge tape pointer and its gas limit are set.\n   * @param _gaugeTape The gauge tape relayed to. The zero address disables the relay.\n   * @param _gasLimit The gas budget for each relayed record call.\n   */\n  event GaugeTapeSet(address indexed _gaugeTape, uint32 _gasLimit);\n\n  /**\n   * @notice Thrown when a caller is not authorized.\n   */\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a zero address is invalid.\n   */\n  error ZeroAddress();\n\n  /**\n   * @notice Thrown when an operator cap is outside the allowed range.\n   */\n  error CapOutOfOperatorRange();\n\n  /**\n   * @notice Thrown when a cap range is invalid.\n   */\n  error InvalidCapRange();\n\n  /**\n   * @notice Thrown when attempting to set the default cap to zero.\n   */\n  error ZeroDefaultCap();\n\n  /**\n   * @notice Thrown when a referral share exceeds the maximum share cap.\n   */\n  error ShareExceedsMax();\n\n  /**\n   * @notice Thrown when the maximum share cap exceeds `MAX_PIPS`.\n   */\n  error InvalidMaxShareCap();\n\n  /**\n   * @notice Thrown when a penalty rate exceeds `MAX_PIPS`.\n   */\n  error InvalidPenaltyRate();\n\n  /**\n   * @notice Thrown when a minimum staking period exceeds MAX_MIN_STAKE_BLOCKS.\n   */\n  error InvalidMinStakeBlocks();\n\n  /**\n   * @notice Thrown when an address is not a gauge created by this factory.\n   */\n  error InvalidGauge();\n\n  /**\n   * @notice Thrown when a referral configuration is invalid.\n   */\n  error InvalidReferral();\n\n  /**\n   * @notice Thrown when the gauges and caps arrays have different lengths.\n   */\n  error LengthMismatch();\n\n  /**\n   * @notice Thrown when the gas left is equal to or below the gas limit set for the external call.\n   */\n  error InsufficientGasForCall();\n\n  /**\n   * @notice Thrown when a zero gas limit is set for the gauge tape relay.\n   */\n  error ZeroGasLimit();\n\n  /**\n   * @notice Relays a gauge's accumulator reading to the gauge tape through a gas-capped fail-open call.\n   * @dev Returns silently when the tape is unset or the caller is not a gauge of this factory, and\n   *      ignores the capped call's outcome, so the gauge action never reverts through the tape. The\n   *      one deliberate revert is the gas guard: the transaction fails when the gas left cannot\n   *      cover the configured budget, closing the starvation path.\n   * @param _rewardPerToken The calling gauge's `rewardPerTokenStored` after the advance.\n   */\n  function recordGaugeTape(uint256 _rewardPerToken) external;\n\n  /**\n   * @notice Sets the gauge tape pointer and the gas budget for each relayed record call.\n   * @dev Only callable by a `GAUGE_TAPE_MANAGER_ROLE` holder. A zero tape disables the relay; a zero gas limit\n   *      reverts. Configure with headroom over the tape's worst record cost: the gas guard admits a\n   *      caller holding just over the limit, and the capped call then receives up to a sixty fourth\n   *      less than it.\n   * @param _gaugeTape The gauge tape to relay to.\n   * @param _gasLimit The gas budget for each relayed record call.\n   */\n  function setGaugeTape(address _gaugeTape, uint32 _gasLimit) external;\n\n  /**\n   * @notice Deploy a gauge for `_target` together with its VotingRewardsManager.\n   * @dev Only callable by the GaugeManager. The VotingRewardsManager is\n   *      deployed through the VotingRewardsFactory against the precomputed\n   *      gauge address before the gauge itself, seeded with the pool's pair\n   *      tokens as the initial reward tokens. Unknown params are ignored.\n   * @param _target Address of the pool the gauge points at.\n   * @param _factoryData Optional encoded creation parameters.\n   * @return _gauge Address of the deployed gauge.\n   * @return _rewards Address of the deployed VotingRewardsManager.\n   */\n  function createGauge(address _target, bytes calldata _factoryData) external returns (address _gauge, address _rewards);\n\n  /**\n   * @notice Set the default emission cap for future gauges.\n   * @dev Existing gauges retain their stored emission caps.\n   * @param _cap New default cap.\n   */\n  function setDefaultCap(uint128 _cap) external;\n\n  /**\n   * @notice Set a per-gauge cap.\n   * @param _gauge Address of the gauge.\n   * @param _cap New stored cap value.\n   */\n  function setEmissionCap(address _gauge, uint128 _cap) external;\n\n  /**\n   * @notice Set per-gauge caps in one batch.\n   * @dev Applies the `setEmissionCap` checks to each entry. Any failing\n   *      entry reverts the whole batch.\n   * @param _gauges Addresses of the gauges.\n   * @param _caps New stored cap values, index-matched to `_gauges`.\n   */\n  function setEmissionCaps(address[] calldata _gauges, uint128[] calldata _caps) external;\n\n  /**\n   * @notice Sets a gauge's emission cap to zero without requiring a successful fee flush.\n   * @dev Only callable by the emergency council.\n   * @param _gauge Address of the gauge to deactivate.\n   */\n  function clearEmissionCap(address _gauge) external;\n\n  /**\n   * @notice Set the inclusive range within which CAP_OPERATOR_ROLE may set per-gauge caps.\n   * @param _minCap New minimum cap.\n   * @param _maxCap New maximum cap.\n   */\n  function setOperatorCapRange(uint128 _minCap, uint128 _maxCap) external;\n\n  /**\n   * @notice Set the factory-wide ceiling on per-gauge referral shares.\n   * @param _cap New maximum referral share cap in PIPS.\n   */\n  function setMaxShareCap(uint256 _cap) external;\n\n  /**\n   * @notice Set or clear referral config for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @param _referral Address receiving the referral share.\n   * @param _share Referral share in PIPS.\n   */\n  function setReferralConfig(address _gauge, address _referral, uint256 _share) external;\n\n  /**\n   * @notice Set the factory-wide penalty defaults.\n   * @param _minStakeBlocks New factory-wide minimum staking period in blocks.\n   * @param _penaltyRate New penalty rate in PIPS.\n   */\n  function setPenaltyConfig(uint256 _minStakeBlocks, uint256 _penaltyRate) external;\n\n  /**\n   * @notice Set a per-gauge minimum staking period override.\n   * @param _gauge Address of the gauge.\n   * @param _minStakeBlocks New minimum staking period override in blocks.\n   */\n  function setMinStakeBlocks(address _gauge, uint256 _minStakeBlocks) external;\n\n  /**\n   * @notice Initial value of `maxShareCap`.\n   * @return _defaultMaxShareCap Default max share cap in PIPS.\n   */\n  function DEFAULT_MAX_SHARE_CAP() external view returns (uint256 _defaultMaxShareCap);\n\n  /**\n   * @notice Initial value of `minStakeBlocks`.\n   * @return _defaultMinStakeBlocks Default minimum staking period in blocks.\n   */\n  function DEFAULT_MIN_STAKE_BLOCKS() external view returns (uint256 _defaultMinStakeBlocks);\n\n  /**\n   * @notice Initial value of `penaltyRate`.\n   * @return _defaultPenaltyRate Default penalty rate in PIPS.\n   */\n  function DEFAULT_PENALTY_RATE() external view returns (uint256 _defaultPenaltyRate);\n\n  /**\n   * @notice OZ AccessControl role for cap administration.\n   * @return _capAdminRole Cap admin role identifier.\n   */\n  function CAP_ADMIN_ROLE() external view returns (bytes32 _capAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for referral configuration.\n   * @return _referralAdminRole Referral admin role identifier.\n   */\n  function REFERRAL_ADMIN_ROLE() external view returns (bytes32 _referralAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for penalty configuration.\n   * @return _penaltyAdminRole Penalty admin role identifier.\n   */\n  function PENALTY_ADMIN_ROLE() external view returns (bytes32 _penaltyAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for per-gauge cap adjustments.\n   * @return _capOperatorRole Cap operator role identifier.\n   */\n  function CAP_OPERATOR_ROLE() external view returns (bytes32 _capOperatorRole);\n\n  /**\n   * @notice OZ AccessControl role administering the gauge tape manager role.\n   * @return _gaugeTapeManagerAdminRole Gauge tape admin role identifier.\n   */\n  function GAUGE_TAPE_MANAGER_ADMIN_ROLE() external view returns (bytes32 _gaugeTapeManagerAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for the gauge tape pointer and its gas limit.\n   * @return _gaugeTapeManagerRole Gauge tape manager role identifier.\n   */\n  function GAUGE_TAPE_MANAGER_ROLE() external view returns (bytes32 _gaugeTapeManagerRole);\n\n  /**\n   * @notice Address of the LeafVoter.\n   * @return _leafVoter Address of the LeafVoter.\n   */\n  function LEAF_VOTER() external view returns (address _leafVoter);\n\n  /**\n   * @notice GaugeManager authorized to call `createGauge`.\n   * @return _gaugeManager Address of the GaugeManager.\n   */\n  function GAUGE_MANAGER() external view returns (address _gaugeManager);\n\n  /**\n   * @notice VotingRewardsFactory deploying each gauge's VotingRewardsManager.\n   * @return _votingRewardsFactory Address of the VotingRewardsFactory.\n   */\n  function VOTING_REWARDS_FACTORY() external view returns (address _votingRewardsFactory);\n\n  /**\n   * @notice Address of the Gauge implementation used for deterministic clones.\n   * @return _implementation Address of the Gauge implementation.\n   */\n  function IMPLEMENTATION() external view returns (address _implementation);\n\n  /**\n   * @notice Computes the deterministic clone address for the gauge deployed\n   *         over `_pool`.\n   * @dev The salt derives from the pool address, so the prediction is fixed\n   *      and unique per pool. The registry links at most one gauge per\n   *      target, so no second deployment ever needs a fresh address.\n   * @param _pool Address of the pool or staking token.\n   * @return _gauge Predicted gauge address.\n   */\n  function computeGaugeAddress(address _pool) external view returns (address _gauge);\n\n  /**\n   * @notice True if this factory creates stable-pool gauges.\n   * @return _isStable Whether gauges created by this factory are for stable pools.\n   */\n  function IS_STABLE() external view returns (bool _isStable);\n\n  /**\n   * @notice Upper bound on per-gauge minimum staking period overrides.\n   * @return _maxMinStakeBlocks Maximum minimum staking period in blocks.\n   */\n  function MAX_MIN_STAKE_BLOCKS() external view returns (uint256 _maxMinStakeBlocks);\n\n  /**\n   * @notice String identifying the gauge type produced by this factory.\n   * @return _gaugeType Gauge type string.\n   */\n  function GAUGE_TYPE() external view returns (string memory _gaugeType);\n\n  /**\n   * @notice True if `_gauge` was deployed by this factory.\n   * @param _gauge Address to check.\n   * @return _isGauge True if `_gauge` was deployed by this factory.\n   */\n  function isGauge(address _gauge) external view returns (bool _isGauge);\n\n  /**\n   * @notice Emission cap stored for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @return _cap Stored emission cap.\n   */\n  function emissionCap(address _gauge) external view returns (uint128 _cap);\n\n  /**\n   * @notice Factory-wide default cap.\n   * @return _defaultCap Current default cap.\n   */\n  function defaultCap() external view returns (uint128 _defaultCap);\n\n  /**\n   * @notice Minimum cap CAP_OPERATOR_ROLE may set on any gauge.\n   * @return _operatorMinCap Operator minimum cap.\n   */\n  function operatorMinCap() external view returns (uint128 _operatorMinCap);\n\n  /**\n   * @notice Maximum cap CAP_OPERATOR_ROLE may set on any gauge.\n   * @return _operatorMaxCap Operator maximum cap.\n   */\n  function operatorMaxCap() external view returns (uint128 _operatorMaxCap);\n\n  /**\n   * @notice Factory-wide ceiling on per-gauge referral shares.\n   * @return _maxShareCap Maximum referral share cap in PIPS.\n   */\n  function maxShareCap() external view returns (uint256 _maxShareCap);\n\n  /**\n   * @notice Returns the referral configuration for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @return _referral Address receiving the referral share.\n   * @return _share Referral share in PIPS.\n   */\n  function referralConfig(address _gauge) external view returns (address _referral, uint256 _share);\n\n  /**\n   * @notice Factory-wide early unstake penalty defaults.\n   * @return _config Current penalty configuration.\n   */\n  function penaltyConfig() external view returns (PenaltyConfig memory _config);\n\n  /**\n   * @notice Effective penalty config for `_gauge`.\n   * @param _gauge The gauge to query.\n   * @return The penalty config with the effective minimum-stake threshold.\n   */\n  function effectivePenaltyConfig(address _gauge) external view returns (PenaltyConfig memory);\n\n  /**\n   * @notice Resolves the effective minimum-stake threshold for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @return _minStakeBlocks Effective minimum staking period in blocks.\n   */\n  function minStakeBlocks(address _gauge) external view returns (uint256 _minStakeBlocks);\n\n  /**\n   * @notice The gauge tape record calls are relayed to. The zero address disables the relay.\n   * @return _gaugeTape The gauge tape.\n   */\n  function gaugeTape() external view returns (address _gaugeTape);\n\n  /**\n   * @notice The gas budget for each relayed record call.\n   * @return _gasLimit The gas budget.\n   */\n  function gaugeTapeGasLimit() external view returns (uint32 _gasLimit);\n}\n"},"V3/src/interfaces/gauges/IV2Gauge.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\n\ninterface IV2Gauge is IGauge {\n  /**\n   * @notice Emitted when staking tokens are deposited into the gauge.\n   * @param _caller The address that supplied the staking tokens.\n   * @param _account The account credited with the deposited stake.\n   * @param _amount The amount of staking tokens deposited.\n   */\n  event Deposit(address indexed _caller, address indexed _account, uint256 _amount);\n\n  /**\n   * @notice Emitted when staking tokens are withdrawn from the gauge.\n   * @param _caller The address that initiated the withdrawal.\n   * @param _account The account whose staked balance was debited.\n   * @param _amount The amount of staking tokens withdrawn.\n   */\n  event Withdraw(address indexed _caller, address indexed _account, uint256 _amount);\n\n  /**\n   * @notice Emitted when accrued emissions are claimed.\n   * @param _account The address of the LP staker whose emissions were claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   * @param _rewardAmount The amount of emissions paid to the recipient.\n   */\n  event EmissionsClaimed(address indexed _account, address indexed _recipient, uint256 _rewardAmount);\n\n  /**\n   * @notice Emitted when accrued emissions are stored instead of claimed during withdrawal.\n   * @param _account The account credited with the deferred emissions.\n   * @param _rewardAmount The post-penalty, post-referral emissions added to the account's deferred balance.\n   */\n  event EmissionsDeferred(address indexed _account, uint256 _rewardAmount);\n\n  /**\n   * @notice Emitted when an account's referral emissions are stored for a later claim.\n   * @param _account The address of the LP staker whose emissions paid the referral.\n   * @param _referral The referral address credited with the emissions.\n   * @param _amount The referral emissions added to the referral's deferred balance.\n   */\n  event ReferralEmissionsDeferred(address indexed _account, address indexed _referral, uint256 _amount);\n\n  /**\n   * @notice Emitted when an account's deferred emissions are claimed.\n   * @param _account The account whose deferred emissions were claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   * @param _amount The deferred emissions paid to the recipient.\n   */\n  event DeferredEmissionsClaimed(address indexed _account, address indexed _recipient, uint256 _amount);\n\n  /**\n   * @notice Emitted when an early withdrawal penalty is applied to an account's accrued emissions.\n   * @param _account The address of the LP staker whose emissions were penalized.\n   * @param _penalty The amount of emissions forfeited as the penalty.\n   */\n  event EarlyWithdrawPenalty(address indexed _account, uint256 _penalty);\n\n  /**\n   * @notice Emitted when an owner sets a withdrawal allowance for an operator.\n   * @param _owner The owner granting the allowance.\n   * @param _operator The operator being granted the allowance.\n   * @param _amount The new allowance amount.\n   */\n  event Approval(address indexed _owner, address indexed _operator, uint256 _amount);\n\n  /**\n   * @notice Thrown when a caller other than the voter attempts to settle rewards.\n   */\n  error NotVoter();\n\n  /**\n   * @notice Thrown when a zero amount is supplied where a non-zero amount is required.\n   */\n  error ZeroAmount();\n\n  /**\n   * @notice Thrown when initializing an already initialized gauge.\n   */\n  error AlreadyInitialized();\n\n  /**\n   * @notice Thrown when an operator's withdrawal allowance is below the requested amount.\n   */\n  error InsufficientAllowance();\n\n  /**\n   * @notice Thrown when depositing for another account while early unstake penalties are active.\n   */\n  error PenaltyActive();\n\n  /**\n   * @notice Initializes clone-specific gauge state.\n   * @param _stakingToken Address of the pool LP token or staking token.\n   * @param _votingRewardsManager Address of the VotingRewardsManager.\n   * @param _isPool Whether the staking token is a V2 pool.\n   */\n  function initialize(address _stakingToken, address _votingRewardsManager, bool _isPool) external;\n\n  /**\n   * @notice Returns whether an account is inside its configured early withdrawal penalty window\n   * @dev Uses the gauge's block source and effective config, independently of accrued rewards or balance\n   * @param _account The address of the LP staker\n   * @return Whether the penalty window is active\n   */\n  function isPenaltyActive(address _account) external view returns (bool);\n\n  /**\n   * @notice The reward-per-token accumulator projected to this block, without a claim.\n   * @dev `rewardPerTokenStored` plus the LeafVoter's projected delta since this gauge's cursor,\n   *      folded over the current supply. With no stakers the stored value is returned as is.\n   * @return _rewardPerToken The projected accumulator.\n   */\n  function projectedRewardPerToken() external view returns (uint256 _rewardPerToken);\n\n  /**\n   * @notice Address of the pool LP token which is deposited (staked) for rewards.\n   * @return The address of the staking token.\n   */\n  function stakingToken() external view returns (address);\n\n  /**\n   * @notice Stored reward-per-token accumulator.\n   * @return The accumulated emissions per staked token.\n   */\n  function rewardPerTokenStored() external view returns (uint256);\n\n  /**\n   * @notice Amount of stakingToken deposited for rewards.\n   * @return The total amount of staking tokens deposited for rewards.\n   */\n  function totalSupply() external view returns (uint256);\n\n  /**\n   * @notice Get the amount of stakingToken deposited by an account.\n   * @param _account The address of the LP staker.\n   * @return The account's deposited staking token balance.\n   */\n  function balanceOf(address _account) external view returns (uint256);\n\n  /**\n   * @notice Returns the block number at which an account most recently deposited\n   * @param _account The address of the LP staker\n   * @return The deposit block for the account\n   */\n  function depositBlock(address _account) external view returns (uint256);\n\n  /**\n   * @notice Cached rewardPerTokenStored for an account based on their most recent action.\n   * @param _account The address of the LP staker.\n   * @return The account's cached reward-per-token value.\n   */\n  function userRewardPerTokenPaid(address _account) external view returns (uint256);\n\n  /**\n   * @notice Cached amount of emissions earned for an account.\n   * @param _account The address of the LP staker.\n   * @return The account's cached earned emissions.\n   */\n  function rewards(address _account) external view returns (uint256);\n\n  /**\n   * @notice Deferred post-penalty, post-referral emissions stored for an account.\n   * @param _account The account credited with the deferred emissions.\n   * @return The account's deferred emissions.\n   */\n  function deferredEmissions(address _account) external view returns (uint256);\n\n  /**\n   * @notice Remaining withdrawal allowance an owner has granted to an operator.\n   * @param _owner The owner that granted the allowance.\n   * @param _operator The operator being queried.\n   * @return The remaining withdrawal allowance.\n   */\n  function allowance(address _owner, address _operator) external view returns (uint256);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC4906.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC4906.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"./IERC165.sol\";\nimport {IERC721} from \"./IERC721.sol\";\n\n/// @title ERC-721 Metadata Update Extension\ninterface IERC4906 is IERC165, IERC721 {\n    /// @dev This event emits when the metadata of a token is changed.\n    /// So that the third-party platforms such as NFT market could\n    /// timely update the images and related attributes of the NFT.\n    event MetadataUpdate(uint256 _tokenId);\n\n    /// @dev This event emits when the metadata of a range of tokens is changed.\n    /// So that the third-party platforms such as NFT market could\n    /// timely update the images and related attributes of the NFTs.\n    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC6372.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC6372.sol)\n\npragma solidity >=0.4.16;\n\ninterface IERC6372 {\n    /**\n     * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n     */\n    function clock() external view returns (uint48);\n\n    /**\n     * @dev Description of the clock\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function CLOCK_MODE() external view returns (string memory);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n    /**\n     * @dev Returns the total amount of tokens stored by the contract.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n     */\n    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n    /**\n     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n     * Use along with {totalSupply} to enumerate all tokens.\n     */\n    function tokenByIndex(uint256 index) external view returns (uint256);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"},"V3/src/interfaces/access/IGuardedAccessControlEnumerable.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @title GuardedAccessControlEnumerable interface\n/// @notice Shared surface for AccessControlEnumerable extensions that block orphaning a self-administering role.\ninterface IGuardedAccessControlEnumerable {\n  /// @notice Thrown when revoking or renouncing would remove the last holder of a self-administering role,\n  ///         permanently freezing that role.\n  /// @param role Role whose last holder cannot be removed.\n  error LastRoleHolder(bytes32 role);\n}\n"},"V3/src/interfaces/core/IVotes.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @notice Modified votes interface for token ID based voting.\ninterface IVotes {\n  /// @notice Emitted when an account changes its delegate.\n  event DelegateChanged(address indexed _delegator, uint256 indexed _fromDelegate, uint256 indexed _toDelegate);\n\n  /// @notice Emitted when a transfer or delegation changes a delegate's voting power.\n  event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n\n  /// @notice Delegates a token ID's votes to another token ID.\n  function delegate(uint256 _delegator, uint256 _delegatee) external;\n\n  /// @notice Delegates votes using an owner signature.\n  function delegateBySig(\n    uint256 _delegator,\n    uint256 _delegatee,\n    uint256 _nonce,\n    uint256 _expiry,\n    uint8 _v,\n    bytes32 _r,\n    bytes32 _s\n  ) external;\n\n  /// @notice Returns the votes a token ID had at a past timepoint for its owner.\n  function getPastVotes(address _account, uint256 _tokenId, uint256 _timepoint) external view returns (uint256);\n\n  /// @notice Returns the total voting power at a past timepoint.\n  function getPastTotalSupply(uint256 _timepoint) external view returns (uint256);\n\n  /// @notice Returns the delegate selected by a token ID.\n  function delegates(uint256 _tokenId) external view returns (uint256);\n}\n"},"V3/src/interfaces/token/IToken.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {IERC20Metadata} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport {IERC20Permit} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol';\n\nimport {ITokenExtensions} from 'V3/interfaces/token/ITokenExtensions.sol';\n\n/// @title IToken\n/// @notice Complete interface for the canonical root token.\ninterface IToken is IERC20, IERC20Metadata, IERC20Permit, ITokenExtensions {}\n"},"V3/src/interfaces/pools/tape/IPoolTape.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title IPoolTape\n/// @notice Records and exposes per-swap cumulative metrics for V2 pools.\ninterface IPoolTape {\n  /*////////////////////////////////////////////////////////////\n                            STRUCTS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Per-pool running cumulatives updated on every swap.\n  /// @param cumulativeFee0 Cumulative token0 fees.\n  /// @param cumulativeFee1 Cumulative token1 fees.\n  /// @param cumulativeVolume0 Cumulative token0 input volume.\n  /// @param cumulativeVolume1 Cumulative token1 input volume.\n  /// @param cumulativeMevVolume0 Cumulative token0 toxic volume.\n  /// @param cumulativeMevVolume1 Cumulative token1 toxic volume.\n  /// @param cumulativeMevFee0 Cumulative token0 MEV fees.\n  /// @param cumulativeMevFee1 Cumulative token1 MEV fees.\n  /// @param lastSwapTimestamp Timestamp of the most recent recorded swap.\n  /// @param swapCount Cumulative swap count.\n  struct Accumulator {\n    // Slot 1\n    uint128 cumulativeFee0;\n    uint128 cumulativeFee1;\n    // Slot 2\n    uint128 cumulativeVolume0;\n    uint128 cumulativeVolume1;\n    // Slot 3\n    uint128 cumulativeMevVolume0;\n    uint128 cumulativeMevVolume1;\n    // Slot 4\n    uint128 cumulativeMevFee0;\n    uint128 cumulativeMevFee1;\n    // Slot 5\n    uint48 lastSwapTimestamp;\n    uint48 swapCount;\n  }\n\n  /// @notice A committed snapshot of the accumulator at a cadence boundary.\n  /// @param cumulativeFee0 Cumulative token0 fees.\n  /// @param cumulativeFee1 Cumulative token1 fees.\n  /// @param cumulativeVolume0 Cumulative token0 input volume.\n  /// @param cumulativeVolume1 Cumulative token1 input volume.\n  /// @param cumulativeMevVolume0 Cumulative token0 toxic volume.\n  /// @param cumulativeMevVolume1 Cumulative token1 toxic volume.\n  /// @param cumulativeMevFee0 Cumulative token0 MEV fees.\n  /// @param cumulativeMevFee1 Cumulative token1 MEV fees.\n  /// @param blockTimestamp Timestamp the observation was committed.\n  /// @param swapCount Cumulative swap count at commit.\n  struct Observation {\n    // Slot 1\n    uint128 cumulativeFee0;\n    uint128 cumulativeFee1;\n    // Slot 2\n    uint128 cumulativeVolume0;\n    uint128 cumulativeVolume1;\n    // Slot 3\n    uint128 cumulativeMevVolume0;\n    uint128 cumulativeMevVolume1;\n    // Slot 4\n    uint128 cumulativeMevFee0;\n    uint128 cumulativeMevFee1;\n    // Slot 5\n    uint48 blockTimestamp;\n    uint48 swapCount;\n  }\n\n  /// @notice The per-pool circular buffer of observations and its metadata.\n  /// @param observations Fixed-size buffer of committed observations.\n  /// @param index Index of the most recently committed observation.\n  /// @param cardinality Number of populated slots in the buffer.\n  /// @param cardinalityNext Number of observation slots that can be populated.\n  struct ObservationBuffer {\n    Observation[65_535] observations;\n    uint16 index;\n    uint16 cardinality;\n    uint16 cardinalityNext;\n  }\n\n  /// @notice Per-swap deltas passed into `record`.\n  /// @param fee0 token0 fee for this swap.\n  /// @param fee1 token1 fee for this swap.\n  /// @param volume0 token0 volume for this swap.\n  /// @param volume1 token1 volume for this swap.\n  /// @param mevVolume0 token0 toxic volume for this swap.\n  /// @param mevVolume1 token1 toxic volume for this swap.\n  /// @param mevFee0 token0 MEV fee for this swap.\n  /// @param mevFee1 token1 MEV fee for this swap.\n  struct PoolTapeData {\n    uint128 fee0;\n    uint128 fee1;\n    uint128 volume0;\n    uint128 volume1;\n    uint128 mevVolume0;\n    uint128 mevVolume1;\n    uint128 mevFee0;\n    uint128 mevFee1;\n  }\n\n  /*////////////////////////////////////////////////////////////\n                    EXTERNAL WRITE FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Records a swap's metrics, accumulating and committing at the cadence boundary.\n  /// @param _pool The pool the swap occurred in.\n  /// @param _data The per-swap deltas.\n  function record(address _pool, PoolTapeData calldata _data) external;\n\n  /*////////////////////////////////////////////////////////////\n                    EXTERNAL VIEW FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Returns the stored observation at an index.\n  /// @dev Callers can get the valid index range from `observationBuffers`. The index must be in\n  ///      `[0, cardinality)` to read written observations.\n  /// @param _pool The pool to read.\n  /// @param _index The buffer index to read.\n  /// @return _observation The stored observation.\n  function getObservation(address _pool, uint16 _index) external view returns (Observation memory _observation);\n\n  /// @notice Returns an interpolated observation for each requested past timestamp (`block.timestamp - secondsAgo`).\n  /// @dev A timestamp at or after the latest swap returns the current accumulator with the requested timestamp,\n  ///      because the cumulatives have not moved since the last swap. A timestamp at or before the oldest stored\n  ///      observation returns the oldest available observation with its own timestamp. An unregistered pool returns zeroed observations.\n  /// @dev A timestamp newer than the newest committed observation is derived from live state, so its value moves\n  ///      as swaps land and a single transaction can shift it. Timestamps at or before the newest committed\n  ///      observation are settled and read the same on every call.\n  /// @param _pool The pool to read.\n  /// @param _secondsAgo The past timestamps to read. A zero timestamp returns the current accumulator.\n  /// @return _observations One observation per timestamp, in the same order as `_secondsAgo`.\n  function observe(\n    address _pool,\n    uint48[] calldata _secondsAgo\n  ) external view returns (Observation[] memory _observations);\n\n  /// @notice The per-pool current accumulator values getter.\n  /// @param _pool The pool to read.\n  /// @return cumulativeFee0 Cumulative token0 fees.\n  /// @return cumulativeFee1 Cumulative token1 fees.\n  /// @return cumulativeVolume0 Cumulative token0 input volume.\n  /// @return cumulativeVolume1 Cumulative token1 input volume.\n  /// @return cumulativeMevVolume0 Cumulative token0 toxic volume.\n  /// @return cumulativeMevVolume1 Cumulative token1 toxic volume.\n  /// @return cumulativeMevFee0 Cumulative token0 MEV fees.\n  /// @return cumulativeMevFee1 Cumulative token1 MEV fees.\n  /// @return lastSwapTimestamp Timestamp of the most recent recorded swap.\n  /// @return swapCount Cumulative swap count.\n  function accumulators(address _pool)\n    external\n    view\n    returns (\n      uint128 cumulativeFee0,\n      uint128 cumulativeFee1,\n      uint128 cumulativeVolume0,\n      uint128 cumulativeVolume1,\n      uint128 cumulativeMevVolume0,\n      uint128 cumulativeMevVolume1,\n      uint128 cumulativeMevFee0,\n      uint128 cumulativeMevFee1,\n      uint48 lastSwapTimestamp,\n      uint48 swapCount\n    );\n}\n"},"node_modules/@openzeppelin/contracts/access/IAccessControl.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)\n\npragma solidity >=0.8.4;\n\n/**\n * @dev External interface of AccessControl declared to support ERC-165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev The `account` is missing a role.\n     */\n    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n    /**\n     * @dev The caller of a function is not the expected one.\n     *\n     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n     */\n    error AccessControlBadConfirmation();\n\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted to signal this.\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).\n     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n"},"V3/src/interfaces/bridge/ILeafMessageOrchestrator.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IMessageAdapter} from 'V3/interfaces/bridge/IMessageAdapter.sol';\nimport {IMessageOrchestrator} from 'V3/interfaces/bridge/IMessageOrchestrator.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title ILeafMessageOrchestrator\n * @notice Leaf-side orchestrator: sends outbound messages to root and routes inbound root messages to the\n * `LeafVoter`.\n * @dev Holds the pre-funding pool that pays root-triggered deallocation returns.\n */\ninterface ILeafMessageOrchestrator is IMessageOrchestrator {\n  /// @notice Emitted when the registered adapter for the root pair is updated.\n  /// @param _current The newly registered adapter.\n  event AdapterUpdated(IMessageAdapter _current);\n\n  /// @notice Emitted when the destination gas limit for a deallocation return is set.\n  /// @param _gasLimit The gas reserved for root's handler of the return.\n  event DeallocationGasLimitSet(uint256 _gasLimit);\n\n  /// @notice Emitted when pre-funding is withdrawn from the orchestrator.\n  /// @param _destination Address that received the withdrawal.\n  /// @param _amount Native amount withdrawn.\n  event NativeWithdrawn(address indexed _destination, uint256 _amount);\n\n  /// @notice Emitted when an inbound claim or operator message arrives past its root-stamped expiry and is dropped.\n  /// @dev The message's nonces stay committed: an expired message never becomes executable, and consuming its\n  ///      nonces keeps older in-flight messages from applying after it.\n  /// @param _msgType Type of the dropped message.\n  /// @param _tokenId veNFT id the dropped message targeted.\n  event ExpiredMessageDropped(MessageType indexed _msgType, uint256 indexed _tokenId);\n\n  /// @notice Reverts when the orchestrator is deployed with a zero `ROOT_CHAIN_ID`, which no adapter could match.\n  error InvalidRootChainId();\n\n  /// @notice Reverts when `setAdapter` is given an adapter whose `REMOTE_CHAIN_ID` is not `ROOT_CHAIN_ID`.\n  error AdapterChainIdMismatch();\n\n  /// @notice Reverts when a `Deallocate` is underfunded: the caller's value or the pool is below the quoted fee.\n  error InsufficientDeallocationMessageValue();\n\n  /// @notice Reverts when a gas-limit setter is called by an address without `GAS_CONFIGURER_ROLE`.\n  error CallerNotGasConfigurer();\n\n  /// @notice Reverts when a gas-limit setter receives zero.\n  error ZeroGasLimit();\n\n  /// @notice Reverts when `withdrawNative` is called by an address without `NATIVE_WITHDRAWER_ROLE`.\n  error CallerNotNativeWithdrawer();\n\n  /// @notice Reverts when the native transfer in `withdrawNative` fails.\n  error WithdrawFailed();\n\n  /// @notice Sets the registered adapter for the root pair. `ADAPTER_CONFIG_ROLE` on the `LeafVoter` only.\n  /// @dev Reverts unless `_adapter.REMOTE_CHAIN_ID()` is `ROOT_CHAIN_ID`, so the leaf's only authenticated route\n  ///      points at root and no other chain can authenticate root-only messages.\n  /// @param _adapter The adapter to register for the root pair.\n  function setAdapter(IMessageAdapter _adapter) external;\n\n  /**\n   * @notice Sends an outbound `Redeem` or `Deallocate` to root through the registered adapter. `LeafVoter` only.\n   * @dev No status check: the `LeafVoter` enforces the status (`redeem` is `chainIsActiveOrSunset`, open only while\n   *      Active or Sunset), and a `Deallocate` goes out even while Suspended so root's booking stays right\n   *      ahead of an emergency deallocation.\n   * @dev A `Deallocate` must cover a live adapter quote, so no configured cost can drift from the real fee.\n   *      Pool-funded draws the exact quote and refunds back into the pool; otherwise the whole `msg.value` goes out.\n   * @param _msgType Routing identifier consumed by the destination handler.\n   * @param _payload Message body; the header is added before sending.\n   * @param _gasLimit Destination gas. Ignored for `Deallocate`, which uses the configured `deallocationGasLimit`.\n   * @param _refundRecipient Transport refund recipient. Ignored when `_fundFromPool` refunds into the pool.\n   * @param _fundFromPool Whether to draw the quoted fee from the pre-funding pool instead of `msg.value`.\n   */\n  function dispatch(\n    MessageType _msgType,\n    bytes calldata _payload,\n    uint256 _gasLimit,\n    address _refundRecipient,\n    bool _fundFromPool\n  ) external payable;\n\n  /// @notice Sets the destination gas limit stamped on every deallocation return. `GAS_CONFIGURER_ROLE` only.\n  /// @dev `dispatch` and `quoteDispatch` both read it for `Deallocate`, so a quote is never taken against a\n  ///      different budget than the send uses.\n  /// @param _gasLimit New destination gas limit for deallocation returns.\n  function setDeallocationGasLimit(uint256 _gasLimit) external;\n\n  /// @notice Withdraws the pre-funding held for root-triggered deallocation returns. `NATIVE_WITHDRAWER_ROLE` only.\n  /// @dev Also the recovery path for inbound message value that arrived without a deallocation to spend it on.\n  /// @param _amount Native amount to withdraw.\n  /// @param _destination Address that receives the withdrawal.\n  function withdrawNative(uint256 _amount, address _destination) external;\n\n  /**\n   * @notice Quotes the native fee a `dispatch` with the same arguments would need.\n   * @dev Prices the wrapped envelope, not the bare payload. The header is fixed-width, so the nonce cannot move the\n   *      quote and a dispatch landing in between cannot invalidate it.\n   * @dev Reverts `AdapterNotRegistered` if no adapter is registered.\n   * @param _msgType Routing identifier the dispatch would stamp.\n   * @param _payload Message body the dispatch would wrap.\n   * @param _gasLimit Destination gas. Ignored for `Deallocate`, priced against `deallocationGasLimit`.\n   * @param _refundRecipient Address the dispatch would name as the transport's refund recipient.\n   * @return _fee Native amount the matching `dispatch` requires.\n   */\n  function quoteDispatch(\n    MessageType _msgType,\n    bytes calldata _payload,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external view returns (uint256 _fee);\n\n  /// @notice Local `LeafVoter` bound to this orchestrator at deployment.\n  /// @dev The only caller allowed to `dispatch`, and the source of the roles checked here.\n  /// @return Local `LeafVoter`.\n  function LEAF_VOTER() external view returns (ILeafVoter);\n\n  /// @notice Chain id of root, the only chain this leaf orchestrator messages. Set at deployment.\n  /// @dev `setAdapter` requires the registered adapter's `REMOTE_CHAIN_ID` to equal this.\n  /// @return Root chain id.\n  function ROOT_CHAIN_ID() external view returns (uint256);\n\n  /// @notice Registered transport adapter for the root pair, or zero if none.\n  /// @return Registered adapter.\n  function adapter() external view returns (IMessageAdapter);\n\n  /// @notice Destination gas limit stamped on every deallocation return, and the budget its fee is quoted against.\n  /// @dev Defaults to zero at deployment. Every `Deallocate` dispatch reverts until governance configures a nonzero\n  ///      limit. A root-triggered return keeps its inbound nonce and redelivers, but only until the allocation's\n  ///      root-stamped expiry: configure within `allocationLifetime` of going live or in-flight votes are lost.\n  /// @return _gasLimit Configured gas limit.\n  function deallocationGasLimit() external view returns (uint256 _gasLimit);\n\n  /// @notice Last outbound nonce stamped on a dispatch to root.\n  /// @return _lastNonce Last outbound nonce.\n  function nonceOut() external view returns (uint256 _lastNonce);\n\n  /// @notice Whether an inbound nonce has already been consumed.\n  /// @dev Single-use replay gate shared by every message type; the voting path adds its own ordering checks.\n  /// @param _nonce Inbound nonce to check.\n  /// @return _isUsed Whether `_nonce` has been consumed.\n  function noncesUsed(uint256 _nonce) external view returns (bool _isUsed);\n\n  /// @notice Highest inbound nonce applied to chain-level vote state.\n  /// @dev Gated apart from token state, so an out-of-order message skips a stale chain update without blocking its\n  ///      token allocation. Applies only when the inbound nonce is strictly greater.\n  /// @return _nonce Highest nonce applied to chain-level vote state.\n  function lastChainVoteNonce() external view returns (uint256 _nonce);\n\n  /// @notice Highest inbound nonce applied to a tokenId's vote and allocation state.\n  /// @dev Gated per tokenId, so a token still updates when its nonce is newer even after the chain nonce moved\n  ///      past it. Applies only when the inbound nonce is strictly greater.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Highest nonce applied to the tokenId's vote state.\n  function lastTokenIdVoteNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n\n  /// @notice Highest inbound nonce applied to a tokenId's operator mirror.\n  /// @dev Kept apart from the vote nonce, or whichever message lands first would mark the other stale. A\n  ///      `SetOperator` applies only when the inbound nonce is strictly greater.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Highest nonce applied to the tokenId's operator mirror.\n  function lastOperatorNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n\n  /// @notice Inbound nonce of the tokenId's last applied `EmergencyDeallocate` message.\n  /// @dev An `AllocateChain` at or below this ships a zero delta, so a message in flight when the emergency ran\n  ///      cannot bring back the cleared position. Zero until the tokenId's first emergency deallocation.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Inbound nonce of the tokenId's last emergency deallocation.\n  function lastEmergencyDeallocNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n\n  /// @notice Highest inbound nonce, across `AllocateChain` and `AllocateGauge`, allowed to refresh the token's shape.\n  /// @dev Both types carry a shape and advance this, so a delayed gauge vote cannot bring back a shape older than a\n  ///      chain reallocation that followed it; it books at the current shape instead.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Highest nonce that refreshed the tokenId's shape.\n  function lastShapeNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n}\n"},"V3/src/interfaces/token/IReceiptTokenExtensions.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IBaseTokenExtensions} from 'V3/interfaces/token/IBaseTokenExtensions.sol';\n\n/// @title IReceiptTokenExtensions\n/// @notice Interface for ReceiptToken custom behavior not covered by the ERC20 interface.\ninterface IReceiptTokenExtensions is IBaseTokenExtensions {\n  /// @notice Thrown when a caller other than the leaf voter tries to mint or burn tokens.\n  error NotLeafVoter();\n\n  /// @notice Mints receipt tokens to an account.\n  /// @param _to The account that receives the minted tokens.\n  /// @param _amount The amount of tokens to mint.\n  function mint(address _to, uint256 _amount) external;\n\n  /// @notice Burns receipt tokens from an account.\n  /// @param _from The account whose tokens are burned.\n  /// @param _amount The amount of tokens to burn.\n  function burn(address _from, uint256 _amount) external;\n\n  /// @notice Returns the leaf voter address.\n  /// @return _leafVoter The address allowed to mint and burn receipt tokens.\n  function LEAF_VOTER() external view returns (address _leafVoter);\n}\n"},"V3/src/interfaces/voter/IVoterCommon.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IVoterCommon\n * @notice Types shared by `IVoter` (root) and `ILeafVoter` (leaf), so the same struct crosses chains unchanged.\n */\ninterface IVoterCommon {\n  /*//////////////////////////////////////////////////////////////\n                                  ENUMS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Per-chain operational status shared by root and leaf voters.\n   * @dev `None` is the enum default (0), so an unregistered chain never passes a status check; registration\n   *      (root) and construction (leaf) set `Active`, and `setChainStatus` cannot set `None`. `Active` allows\n   *      everything, `Paused` blocks the chain's operations.\n   * @dev `Suspended` is the emissions kill switch: root rejects inbound messages and sends the chain's accrual to\n   *      surplus, the leaf blocks outbound dispatch and user entrypoints but still applies root messages at rate\n   *      zero, so its mirror repairs itself without accruing unfunded emissions.\n   * @dev `Sunset` is the wind-down. Root stops accepting chain allocations, sends the chain's accrual to\n   *      surplus like `Suspended`, and keeps processing redeems and deallocations. Gauge votes, operator\n   *      updates and cooldown reductions still dispatch so booked voting power can exit through `DEALLOC_GAUGE`;\n   *      the chain accrues nothing, so they move no emissions. The leaf parks its scalar at zero but keeps\n   *      `allocateGauges`, `mintEmissions` and `redeem` open, so everything already earned stays claimable and\n   *      redeemable. Its only exit is `Suspended`, the kill switch for a compromised or unreachable sunset\n   *      chain and the mandatory first leg of a reactivation (see `IVoter.setChainStatus`).\n   * @param None Uninitialized sentinel, the state of an unregistered chain.\n   * @param Active Fully operational.\n   * @param Paused Chain operations blocked on both sides; accrual continues.\n   * @param Suspended Emissions kill switch; accrual goes to surplus and user entrypoints close.\n   * @param Sunset Wind-down; accrual goes to surplus, exits stay open, chain allocations close.\n   */\n  enum ChainStatus {\n    None,\n    Active,\n    Paused,\n    Suspended,\n    Sunset\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Snapshot of decaying voting power at a point in time.\n   * @param bias Current voting power; decays linearly.\n   * @param slope Rate of decay per second.\n   * @param ts Timestamp of last resolution.\n   * @param permanentStakeBalance Non-decaying voting power from permanent stakes.\n   */\n  struct Point {\n    int128 bias;\n    int128 slope;\n    uint48 ts;\n    uint128 permanentStakeBalance;\n  }\n\n  /**\n   * @notice One gauge leg of a tokenId's vote. Sent to the leaf in the dispatch payload; root keeps no copy.\n   * @param gauge Target gauge address.\n   * @param allocated Absolute AERO for this gauge, not a percentage; Σ within a chain equals that chain's total.\n   * @param data Opaque per-gauge payload forwarded unchanged to the leaf.\n   */\n  struct GaugeAllocation {\n    address gauge;\n    uint128 allocated;\n    bytes data;\n  }\n\n  /**\n   * @notice VE state at dispatch, so the leaf can rebuild the tokenId's contribution shape locally.\n   * @dev The leaf derives bias, slope and permanent balance from `_contribution(allocated, stakeEnd, isPermanent)`,\n   *      settled at its own `block.timestamp`. `isPermanent` is the permanence discriminator, not `stakeEnd == 0`.\n   * @param staked AERO staked in the veNFT at dispatch time.\n   * @param stakeEnd Week-aligned stake expiry; `0` for a permanent stake.\n   * @param isPermanent True for a permanent stake; the permanence signal the leaf reads.\n   */\n  struct TokenSnapshot {\n    uint128 staked;\n    uint48 stakeEnd;\n    bool isPermanent;\n  }\n\n  /**\n   * @notice Chain-level allocation from root to a leaf: sets the tokenId's budget on the chain and the chain's\n   *         emissions scalar. No gauges and no cooldown — chain assignment always applies.\n   * @dev Applied additively on the leaf, so it can never bring back a budget the leaf-first `deallocate` removed.\n   *      Reductions go leaf-first through `deallocate`, never through this message.\n   * @dev The MessageOrchestrator stamps `chainNonce` and `dispatchedAt` and wraps every message body below in\n   *      the `(MessageType, chainNonce, dispatchedAt, bytes)` transport envelope; these structs are the\n   *      Voter→Orchestrator body only.\n   * @param tokenId Originating tokenId.\n   * @param allocationDelta Voting power added to the token's budget here, drawn from `CHAIN0`; always an increase.\n   * @param emissionsPerVP Global emissions per unit voting power, `PRECISION`-scaled; the leaf's index rate.\n   * @param snapshot Live VE shape at dispatch, which anchors the token's booked shape on the leaf.\n   */\n  struct AllocateChainMessage {\n    uint256 tokenId;\n    uint128 allocationDelta;\n    uint256 emissionsPerVP;\n    TokenSnapshot snapshot;\n  }\n\n  /**\n   * @notice Gauge distribution from root to a leaf, spreading the tokenId's chain budget across gauges.\n   * @dev Cooldown-gated on the leaf: it reverts while the cooldown still runs and the transport redelivers later.\n   * @param tokenId Originating tokenId.\n   * @param expiry Absolute deadline stamped by root; past it the leaf reverts `AllocationExpired`.\n   * @param emissionsPerVP Emissions per unit voting power, `PRECISION`-scaled; only the leaf's newest message\n   *                       refreshes its scalar.\n   * @param tokenSnapshot Live VE state at dispatch, used to shape each gauge's contribution.\n   * @param allocations Per-gauge allocations on this chain. Empty clears the tokenId's gauge weight.\n   */\n  struct AllocateGaugeMessage {\n    uint256 tokenId;\n    uint48 expiry;\n    uint256 emissionsPerVP;\n    TokenSnapshot tokenSnapshot;\n    GaugeAllocation[] allocations;\n  }\n\n  /**\n   * @notice Cooldown reduction from root to a leaf. The leaf accrues it and the token's next gauge allocation,\n   *         bridged or local, spends it clamped to `allocationCooldown`.\n   * @dev Reductions accrue additively, so message order does not matter and no reduction-specific nonce gate is\n   *      needed; the global replay gate applies each one exactly once.\n   * @param tokenId veNFT id whose pending cooldown reduction is being increased.\n   * @param reduction Seconds added to the tokenId's pending cooldown reduction on this chain.\n   */\n  struct ReduceCooldownMessage {\n    uint256 tokenId;\n    uint48 reduction;\n  }\n\n  /**\n   * @notice Emergency unwind from root to a leaf after root drained `amount` from a `Suspended` chain: the leaf\n   *         clears the tokenId's gauges and re-parks the remaining budget (`budget - amount`) on `ZERO_GAUGE`.\n   * @dev It subtracts a fixed amount instead of zeroing, so `AllocateChain` deltas booked before the drain need\n   *      no ordering gate; the leaf drops stale pre-drain deltas by message nonce.\n   * @dev It over-subtracts if a POST-resume delta lands first, so resume is gated on delivery — see the\n   *      precondition on `IVoter.setChainStatus`.\n   * @param tokenId veNFT id whose position on the chain is being reduced.\n   * @param amount Chain budget root drained to `CHAIN0`; the leaf subtracts it, clamped at zero.\n   */\n  struct EmergencyDeallocateMessage {\n    uint256 tokenId;\n    uint128 amount;\n  }\n\n  /**\n   * @notice Redeem payload dispatched from a leaf to root.\n   * @param amount Amount of `ReceiptToken` burned on the leaf and `TOKEN` to mint on root.\n   * @param recipient Address that receives the minted `TOKEN` on root.\n   * @param surplusAccrued Cumulative surplus accumulator snapshot reported by the leaf.\n   */\n  struct RedeemMessageBody {\n    uint256 amount;\n    address recipient;\n    uint256 surplusAccrued;\n  }\n\n  /**\n   * @notice Deallocation confirmation from a leaf to root, so root credits `CHAIN0` only once the leaf confirms.\n   * @param tokenId veNFT id whose voting power was deallocated on the leaf.\n   * @param amount Voting power deallocated on the leaf, to credit back to `CHAIN0` on root.\n   */\n  struct DeallocationMessageBody {\n    uint256 tokenId;\n    uint128 amount;\n  }\n\n  /**\n   * @notice Operator assignment from root to a leaf, keeping the leaf's `operators[tokenId]` mirror in sync.\n   * @param tokenId veNFT id whose operator is being set.\n   * @param expiry Absolute deadline stamped by root; past it the leaf drops the message with\n   * `ExpiredMessageDropped`.\n   * @param operator New operator address. Zero clears the slot.\n   */\n  struct OperatorMessage {\n    uint256 tokenId;\n    uint48 expiry;\n    address operator;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when `setChainStatus` is called with the chain's current status, a no-op write.\n  error ChainStatusUnchanged();\n\n  /**\n   * @notice Thrown when `setChainStatus` moves a `Suspended` chain to `Paused`, or a `Sunset` chain to\n   *         anything but `Suspended`. A `None` target reverts with `InvalidStatus` first.\n   * @dev A `Paused` exit restarts ceiling accrual at the stored rate while the leaf still distributes nothing,\n   *      and `Paused` blocks the vote pipeline, so no message could resync the leaf for that whole period.\n   *      `Sunset` exits only through `Suspended`, so a reactivation always drains the in-flight deallocation\n   *      set before any resume and a dead sunset chain keeps its kill switch.\n   */\n  error InvalidChainStatusTransition();\n\n  /// @notice Thrown when `setChainStatus` is called with `None`, the uninitialized sentinel status.\n  error InvalidStatus();\n\n  /// @notice Thrown when a constructor receives a zero address argument.\n  error ZeroAddress();\n\n  /// @notice Thrown when the token's stake is expired.\n  error StakeExpired();\n\n  /// @notice Thrown when a vote on a sunset chain carries anything but the lone `DEALLOC_GAUGE` return.\n  error SunsetDeallocOnly();\n\n  /// @notice Thrown when an allocation entry carries a zero `allocated` amount.\n  error ZeroAllocation();\n\n  /// @notice Thrown when `msg.value` is attached but there is no return message to fund.\n  error UnexpectedValue();\n\n  /// @notice Thrown when an allocation's gauges are not strictly ascending by address, which also rejects\n  ///         duplicates.\n  error GaugesNotStrictlyAscending();\n}\n"},"V3/src/interfaces/bridge/IRootMessageOrchestrator.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IMessageAdapter} from 'V3/interfaces/bridge/IMessageAdapter.sol';\nimport {IMessageOrchestrator} from 'V3/interfaces/bridge/IMessageOrchestrator.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\n\n/**\n * @title IRootMessageOrchestrator\n * @notice Root-side orchestrator: sends outbound messages from the local `Voter` to many leaves and routes inbound\n * `Redeem` and `Deallocate` messages back to it.\n */\ninterface IRootMessageOrchestrator is IMessageOrchestrator {\n  /**\n   * @notice One destination's share of a dispatch sent by the `Voter`.\n   * @param chainId Destination chain id.\n   * @param gasLimit Execution gas reserved for the destination handler.\n   * @param nativeValue Transport fee, plus the kept `deallocationReturnCost` when `chargeDeallocationReturn` is set.\n   * @param chargeDeallocationReturn Whether to keep this chain's `deallocationReturnCost` out of `nativeValue`.\n   * @param payload Message body; the header is added before sending.\n   */\n  struct ChainDispatch {\n    uint256 chainId;\n    uint256 gasLimit;\n    uint256 nativeValue;\n    bool chargeDeallocationReturn;\n    bytes payload;\n  }\n\n  /// @notice Emitted when the registered adapter for a destination chain is updated.\n  /// @param _chainId Destination chain id whose adapter slot was updated.\n  /// @param _current The newly registered adapter.\n  event AdapterUpdated(uint256 _chainId, IMessageAdapter _current);\n\n  /// @notice Emitted when the deallocation return cost for a destination chain is set.\n  /// @param _chainId Destination chain id whose cost was set.\n  /// @param _cost The newly configured cost.\n  event DeallocationReturnCostSet(uint256 indexed _chainId, uint256 _cost);\n\n  /// @notice Emitted when the kept native ETH is withdrawn.\n  /// @param _destination Address that received the withdrawal.\n  /// @param _amount Native amount withdrawn.\n  event NativeWithdrawn(address indexed _destination, uint256 _amount);\n\n  /// @notice Reverts when `dispatch` gets a `msg.value` that does not equal the sum of every `nativeValue`.\n  error InvalidDispatchValue();\n\n  /// @notice Reverts when `setAdapter` is invoked with a chain id of zero, a value reserved as a sentinel.\n  error InvalidChainId();\n\n  /// @notice Reverts when `setAdapter` gets an adapter whose `REMOTE_CHAIN_ID` is not the registered chain id.\n  error AdapterChainIdMismatch();\n\n  /// @notice Reverts when a charging dispatch supplies a `nativeValue` below the chain's `deallocationReturnCost`.\n  error InsufficientDeallocationReturnCost();\n\n  /// @notice Reverts when a non-zero cost is set on the root-colocated leaf, whose adapter takes no transport value.\n  error DeallocationReturnCostNotAllowed();\n\n  /// @notice Reverts when a configuration call targets a chain the `Voter` has not registered.\n  /// @param _chainId The unregistered chain id.\n  error ChainNotRegistered(uint256 _chainId);\n\n  /// @notice Reverts when `setDeallocationReturnCost` is called by an address without `VOTER_CONFIG_ROLE`.\n  error CallerNotVoterConfigAuthority();\n\n  /// @notice Reverts when `withdrawNative` is called by an address without `NATIVE_WITHDRAWER_ROLE`.\n  error CallerNotNativeWithdrawer();\n\n  /// @notice Reverts when the native transfer in `withdrawNative` fails.\n  error WithdrawFailed();\n\n  /// @notice Sets the registered adapter for a destination chain. `ADAPTER_CONFIG_ROLE` on the `Voter` only.\n  /// @dev Reverts if `_chainId` is zero, `_adapter` is zero, or `_adapter.REMOTE_CHAIN_ID()` is not `_chainId`.\n  /// @param _chainId Destination chain id to register the adapter for.\n  /// @param _adapter The adapter to register. Must report `REMOTE_CHAIN_ID == _chainId`.\n  function setAdapter(uint256 _chainId, IMessageAdapter _adapter) external;\n\n  /**\n   * @notice Sends one outbound message per destination through the matching adapter. Local `Voter` only.\n   * @dev Reverts `InvalidDispatchValue` unless `msg.value` equals the sum of every `nativeValue`. Every adapter,\n   *      cost and fee is resolved before the first send, since a send hands control to `_refundRecipient`.\n   * @dev A destination with `chargeDeallocationReturn` keeps its chain's `deallocationReturnCost` here, withdrawable\n   *      to top the leaf up; only the rest is forwarded as the transport fee, which the caller quotes off-chain.\n   * @param _msgType Routing identifier shared by every dispatch.\n   * @param _dispatches Per-destination dispatches.\n   * @param _refundRecipient Address the transport refunds any excess fee to.\n   */\n  function dispatch(\n    MessageType _msgType,\n    ChainDispatch[] calldata _dispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /// @notice Sets the native amount kept per dispatch that carries a deallocation return. `VOTER_CONFIG_ROLE` only.\n  /// @dev Reverts unless the chain is registered on the `Voter`. Must be zero for the root-colocated leaf, whose\n  ///      `RootLocalAdapter` takes no transport value.\n  /// @param _chainId Destination chain the cost applies to.\n  /// @param _cost Native amount kept on each charging dispatch to `_chainId`.\n  function setDeallocationReturnCost(uint256 _chainId, uint256 _cost) external;\n\n  /// @notice Withdraws the collected deallocation return costs. `NATIVE_WITHDRAWER_ROLE` on the `Voter` only.\n  /// @dev Pays for the manual leaf top-up that keeps each leaf able to front its return messages.\n  /// @param _amount Native amount to withdraw.\n  /// @param _destination Address that receives the withdrawal.\n  function withdrawNative(uint256 _amount, address _destination) external;\n\n  /// @notice Local `Voter` bound to this orchestrator at deployment.\n  /// @dev The only caller allowed to `dispatch`. It owns the chain registry and the roles checked here; the\n  ///      orchestrator holds none.\n  /// @return Local `Voter`.\n  function VOTER() external view returns (IVoter);\n\n  /// @notice Registered transport adapter for a destination chain, or zero if none.\n  /// @param _chainId Destination chain id.\n  /// @return Registered adapter for `_chainId`.\n  function adapters(uint256 _chainId) external view returns (IMessageAdapter);\n\n  /// @notice Native amount kept per dispatch that carries a deallocation return, covering the gas the leaf fronts.\n  /// @param _chainId Destination chain id.\n  /// @return _cost Configured cost for `_chainId`.\n  function deallocationReturnCost(uint256 _chainId) external view returns (uint256 _cost);\n\n  /// @notice Last outbound nonce stamped on a dispatch to a destination chain.\n  /// @param _chainId Destination chain id.\n  /// @return _lastNonce Last outbound nonce for `_chainId`.\n  function nonceOut(uint256 _chainId) external view returns (uint256 _lastNonce);\n\n  /// @notice Whether an inbound nonce has already been consumed for a source chain.\n  /// @dev Single-use replay gate: a nonce that reads true makes `route` revert `NonceAlreadyUsed`.\n  /// @param _chainId Source chain id.\n  /// @param _nonce Inbound nonce to check.\n  /// @return _isUsed Whether `_nonce` has been consumed for `_chainId`.\n  function noncesUsed(uint256 _chainId, uint256 _nonce) external view returns (bool _isUsed);\n}\n"},"V3/src/interfaces/minter/IMinter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IMinter\n * @notice Root side minter interface for emission rate configuration and redeem triggered TOKEN minting.\n */\ninterface IMinter {\n  /**\n   * @notice Constructor parameters for `Minter`.\n   * @dev There is no minimum base rate. Rate-change limits round up to one unit when the calculated limit is below\n   * one unit. Deployments must use a base rate large enough that this rounding does not weaken the intended\n   * percentage limit.\n   * @param token Root token minted on redemption.\n   * @param voter Root voter authorized to call `mint` and expose the current governor.\n   * @param splitter Destination for the team rate mint share.\n   * @param operator Address authorized to update the base emission rate.\n   * @param fed Address authorized to configure the dynamic rate module, or zero when unassigned.\n   * @param migrationOpen Future migration opening. Emissions and cap accrual start at the next epoch boundary.\n   * @param initialBaseRate Initial non zero base emission rate, at most `MAX_BASE_RATE`.\n   * @param maxBaseRateChangePips Initial maximum base rate change in pips. Zero pauses base rate updates.\n   * @param baseRateUpdateCooldown Initial cooldown between accepted base rate updates.\n   * @param teamRate Initial team mint share in pips.\n   * @param maxBaseRateChangePipsCap Immutable cap for `maxBaseRateChangePips`.\n   * @param minBaseRateUpdateCooldown Immutable lower bound for `baseRateUpdateCooldown`.\n   * @param maxBaseRateUpdateCooldown Immutable upper bound for `baseRateUpdateCooldown`.\n   * @param maxBandFloorPips Immutable cap for `bandFloorPips`.\n   * @param maxBandCeilingPips Immutable cap for `bandCeilingPips`.\n   */\n  struct ConstructorParams {\n    address token;\n    address voter;\n    address splitter;\n    address operator;\n    address fed;\n    uint48 migrationOpen;\n    uint232 initialBaseRate;\n    uint24 maxBaseRateChangePips;\n    uint48 baseRateUpdateCooldown;\n    uint24 teamRate;\n    uint24 maxBaseRateChangePipsCap;\n    uint48 minBaseRateUpdateCooldown;\n    uint48 maxBaseRateUpdateCooldown;\n    uint24 maxBandFloorPips;\n    uint24 maxBandCeilingPips;\n  }\n\n  /**\n   * @notice Emitted when the operator updates the base emission rate.\n   * @param _baseRate New base emission rate.\n   */\n  event BaseRateSet(uint232 _baseRate);\n\n  /**\n   * @notice Emitted when the dynamic emission rate target changes.\n   * @dev Emitted by the dynamic rate module when it pushes a target and by the FED when disabling the module\n   * clears the target.\n   * @param _rate New dynamic emission rate target, stored raw and clamped to the band on read.\n   */\n  event DynamicRateSet(uint256 _rate);\n\n  /**\n   * @notice Emitted when governance updates the operator address.\n   * @param _operator New operator address.\n   */\n  event OperatorSet(address indexed _operator);\n\n  /**\n   * @notice Emitted when governance updates the FED address.\n   * @param _fed New FED address.\n   */\n  event FEDSet(address indexed _fed);\n\n  /**\n   * @notice Emitted when governance updates the maximum base rate change.\n   * @param _maxBaseRateChangePips New maximum base rate change in pips.\n   */\n  event MaxBaseRateChangePipsSet(uint24 _maxBaseRateChangePips);\n\n  /**\n   * @notice Emitted when governance updates the base rate update cooldown.\n   * @param _baseRateUpdateCooldown New cooldown in seconds.\n   */\n  event BaseRateUpdateCooldownSet(uint48 _baseRateUpdateCooldown);\n\n  /**\n   * @notice Emitted when governance updates the team mint share.\n   * @param _teamRate New team mint share in pips.\n   */\n  event TeamRateSet(uint24 _teamRate);\n\n  /**\n   * @notice Emitted when governance updates the dynamic rate band.\n   * @param _floorPips Maximum downward movement from base rate in pips.\n   * @param _ceilingPips Maximum upward movement from base rate in pips.\n   */\n  event RateBandSet(uint24 _floorPips, uint24 _ceilingPips);\n\n  /**\n   * @notice Emitted when the FED updates the dynamic rate module authorized to push the dynamic rate.\n   * @param _module New dynamic rate module, or zero address when unassigned.\n   */\n  event DynamicRateModuleSet(address _module);\n\n  /**\n   * @notice Emitted after a successful redeem triggered mint.\n   * @param _recipient Recipient of the redeemed amount.\n   * @param _amount Redeemed amount minted to `_recipient`.\n   * @param _splitterShare Team share minted to `SPLITTER`.\n   */\n  event Minted(address indexed _recipient, uint256 _amount, uint256 _splitterShare);\n\n  /// @notice Reverts when an address parameter that cannot be zero is zero.\n  error ZeroAddress();\n\n  /// @notice Reverts when the configured splitter is the minter contract itself.\n  error InvalidSplitter();\n\n  /// @notice Reverts when a base rate is zero.\n  error InvalidBaseRate();\n\n  /// @notice Reverts when a base rate exceeds `MAX_BASE_RATE`.\n  error BaseRateTooHigh();\n\n  /// @notice Reverts when the configured migration opening is not in the future.\n  error InvalidActivationTimestamp();\n\n  /// @notice Reverts when `teamRate` exceeds `MAXIMUM_TEAM_RATE`.\n  error TeamRateTooHigh();\n\n  /// @notice Reverts when the immutable max change cap exceeds the weekly maximum rate change.\n  error MaxBaseRateChangeCapTooHigh();\n\n  /// @notice Reverts when the immutable max change cap is zero.\n  error MaxBaseRateChangeCapTooLow();\n\n  /// @notice Reverts when `maxBaseRateChangePips` exceeds its immutable cap.\n  error MaxBaseRateChangeTooHigh();\n\n  /// @notice Reverts when the paired max change and cooldown allow excessive compounded rate movement.\n  error RateControlsTooAggressive();\n\n  /// @notice Reverts when the immutable minimum cooldown is zero.\n  error MinCooldownTooLow();\n\n  /// @notice Reverts when the minimum cooldown exceeds the maximum cooldown.\n  error InvalidCooldownRange();\n\n  /// @notice Reverts when `baseRateUpdateCooldown` is below its immutable minimum.\n  error CooldownTooLow();\n\n  /// @notice Reverts when `baseRateUpdateCooldown` exceeds its immutable maximum.\n  error CooldownTooHigh();\n\n  /// @notice Reverts when the immutable floor band cap is zero.\n  error BandFloorCapTooLow();\n\n  /// @notice Reverts when the immutable floor band cap reaches or exceeds `MAX_PIPS`, which would\n  ///         allow a zero rate.\n  error BandFloorCapTooWide();\n\n  /// @notice Reverts when the immutable ceiling band cap is zero.\n  error BandCeilingCapTooLow();\n\n  /// @notice Reverts when the immutable ceiling band cap exceeds `MAX_PIPS`.\n  error BandCeilingCapTooWide();\n\n  /// @notice Reverts when `mint` is called by any address other than `VOTER`.\n  error CallerNotVoter();\n\n  /// @notice Reverts when a mint amount is below `MIN_MINT_AMOUNT`.\n  error AmountTooLow();\n\n  /// @notice Reverts when a mint would push `emissionsMinted` above `emissionsCap`.\n  error CapExceeded();\n\n  /// @notice Reverts when a governance gated setter is called by an address without `VOTER.GOVERNANCE_ROLE`.\n  error CallerNotGovernor();\n\n  /// @notice Reverts when `operator` and `fed` would become the same address.\n  error OperatorFEDCollision();\n\n  /// @notice Reverts when the floor band exceeds `MAX_BAND_FLOOR_PIPS`.\n  error BandFloorTooWide();\n\n  /// @notice Reverts when the ceiling band exceeds `MAX_BAND_CEILING_PIPS`.\n  error BandCeilingTooWide();\n\n  /// @notice Reverts when `setBaseRate` is called by any address other than `operator`.\n  error CallerNotOperator();\n\n  /// @notice Reverts when a base rate update is attempted before `nextBaseRateUpdate`.\n  error CooldownActive();\n\n  /// @notice Reverts when a base rate update would not change the rate.\n  error SameRate();\n\n  /**\n   * @notice Reverts when a base rate update exceeds the allowed change.\n   * @dev The allowed change is `baseRate * maxBaseRateChangePips / MAX_PIPS` rounded up, so it is\n   * never zero for a non zero `maxBaseRateChangePips` and can exceed the nominal fraction at small base rates.\n   */\n  error RateChangeExceedsMax();\n\n  /// @notice Reverts when `setDynamicRateModule` is called by any address other than `fed`.\n  error CallerNotFED();\n\n  /// @notice Reverts when `setDynamicRate` is called by any address other than `dynamicRateModule`.\n  error CallerNotDynamicRateModule();\n\n  /**\n   * @notice Mints TOKEN for a redeem recipient and optionally mints the team share to `SPLITTER`.\n   * @dev Amounts below `MIN_MINT_AMOUNT` revert so a non zero team rate share cannot round down to zero. The\n   * leaf redeem entrypoint must enforce the same floor so a leaf side redeem can never be refused at settlement.\n   * @dev The recipient amount counts against the accrued emissions cap. The team share does not count against\n   * the cap because it is derived from the recipient amount and bounded separately by `MAXIMUM_TEAM_RATE`.\n   * @param _amount Amount of TOKEN to mint to the recipient.\n   * @param _recipient Recipient of the redeemed amount.\n   */\n  function mint(uint256 _amount, address _recipient) external;\n\n  /**\n   * @notice Updates the operator address. Governance only.\n   * @param _operator New operator address.\n   */\n  function setOperator(address _operator) external;\n\n  /**\n   * @notice Updates the FED address. Governance only.\n   * @param _fed New FED address, or zero address to leave the role unassigned.\n   */\n  function setFED(address _fed) external;\n\n  /**\n   * @notice Updates the maximum allowed base rate change. Governance only.\n   * @dev A zero value pauses base rate updates until governance raises it. Successful calls delay\n   * `nextBaseRateUpdate` to at least one week from the call without shortening a later deadline.\n   * @param _maxBaseRateChangePips New maximum base rate change in pips.\n   */\n  function setMaxBaseRateChangePips(uint24 _maxBaseRateChangePips) external;\n\n  /**\n   * @notice Updates the base rate update cooldown. Governance only.\n   * @dev Successful calls delay `nextBaseRateUpdate` to at least one week from the call without shortening a later\n   * deadline.\n   * @param _baseRateUpdateCooldown New cooldown in seconds.\n   */\n  function setBaseRateUpdateCooldown(uint48 _baseRateUpdateCooldown) external;\n\n  /**\n   * @notice Updates the team mint share. Governance only.\n   * @param _teamRate New team mint share in pips.\n   */\n  function setTeamRate(uint24 _teamRate) external;\n\n  /**\n   * @notice Updates the dynamic module rate band. Governance only.\n   * @dev The band is the current limit on the module's authority, not a snapshot taken at push time. Because\n   * `setDynamicRate` stores its target raw, widening the band raises the effective rate of a target already pushed\n   * and narrowing it lowers that rate, in both directions without a new module push. The cap accrues at the\n   * outgoing effective rate first, so a band change only ever applies forward.\n   * @param _floorPips Maximum downward movement from base rate in pips.\n   * @param _ceilingPips Maximum upward movement from base rate in pips.\n   */\n  function setRateBand(uint24 _floorPips, uint24 _ceilingPips) external;\n\n  /**\n   * @notice Updates the base emission rate. Operator only.\n   * @dev There is no minimum base rate. The allowed change rounds up to one unit, so a small base rate can change\n   * by more than the configured percentage.\n   * @param _newRate New non zero base emission rate, at most `MAX_BASE_RATE`.\n   */\n  function setBaseRate(uint232 _newRate) external;\n\n  /**\n   * @notice Updates the dynamic rate module authorized to push the dynamic rate. FED only.\n   * @dev Setting the module to zero accrues the cap at the outgoing effective rate, then clears `dynamicRate` so\n   * emissions fall back to `baseRate`. Replacing one non-zero module with another preserves the current target\n   * until the replacement pushes a new one.\n   * @param _module New dynamic rate module, or zero address to leave the push role unassigned.\n   */\n  function setDynamicRateModule(address _module) external;\n\n  /**\n   * @notice Accrues the emissions cap and stores a new dynamic emission rate target. Dynamic rate module only.\n   * @dev Stores `_rate` raw; the band clamp is applied on read by `emissionRate`, so a later `baseRate` or band\n   * change re-scopes the emission without another push. Setting the target to zero neutralizes the dynamic\n   * override. The cap accrues only from `ACTIVATION_TIMESTAMP`.\n   * @param _rate New dynamic emission rate target, stored raw and clamped to the band on read.\n   */\n  function setDynamicRate(uint256 _rate) external;\n\n  /**\n   * @notice Returns the emission rate read by the root voter.\n   * @dev Returns zero while `block.timestamp < ACTIVATION_TIMESTAMP`; otherwise returns the stored `dynamicRate`\n   * clamped to the band around the current `baseRate`. An unset band pins the effective rate to `baseRate`.\n   * @return _rate Zero before activation; otherwise the effective rate after band clamping.\n   */\n  function emissionRate() external view returns (uint256 _rate);\n\n  /**\n   * @notice Minimum mintable amount. Matches `MAX_PIPS` so a non zero team rate share cannot\n   *         round down to zero.\n   * @return _minMintAmount Minimum mintable amount.\n   */\n  function MIN_MINT_AMOUNT() external view returns (uint256 _minMintAmount);\n\n  /**\n   * @notice Maximum allowed team rate.\n   * @return _maximumTeamRate Maximum allowed team rate in pips.\n   */\n  function MAXIMUM_TEAM_RATE() external view returns (uint256 _maximumTeamRate);\n\n  /**\n   * @notice Maximum weekly base rate change budget.\n   * @return _maxWeeklyRateChangePips Maximum weekly base rate change in pips.\n   */\n  function MAX_WEEKLY_RATE_CHANGE_PIPS() external view returns (uint24 _maxWeeklyRateChangePips);\n\n  /**\n   * @notice Weekly natural log budget used to scale shorter cooldowns.\n   * @return _weeklyLogBudgetPips Weekly natural log budget in pips.\n   */\n  function WEEKLY_LOG_BUDGET_PIPS() external view returns (uint24 _weeklyLogBudgetPips);\n\n  /**\n   * @notice Maximum accepted base emission rate.\n   * @dev Bounds rate-dependent Minter and Voter arithmetic over the full `uint48` timestamp horizon. The effective\n   * rate is at most twice the base rate. At the minimum non-zero voting weight of one, the Voter scales that rate\n   * by `1e18`, and its time-weighted accumulator grows by at most `type(uint48).max ** 2`. The bound is therefore\n   * `floor(type(uint256).max / (2 * 1e18 * type(uint48).max ** 2))`, equal to\n   * `730750818665456651398700951213`. This remains far above any viable emission rate.\n   * @return _maxBaseRate Maximum accepted base emission rate.\n   */\n  function MAX_BASE_RATE() external view returns (uint232 _maxBaseRate);\n\n  /**\n   * @notice Root token minted on redemption.\n   * @return _token Root token address.\n   */\n  function TOKEN() external view returns (address _token);\n\n  /**\n   * @notice Root voter authorized to call `mint`.\n   * @return _voter Root voter address.\n   */\n  function VOTER() external view returns (address _voter);\n\n  /**\n   * @notice Team share splitter.\n   * @return _splitter Splitter address.\n   */\n  function SPLITTER() external view returns (address _splitter);\n\n  /**\n   * @notice Timestamp at which emissions become active.\n   * @return _activationTimestamp Emission activation timestamp.\n   */\n  function ACTIVATION_TIMESTAMP() external view returns (uint48 _activationTimestamp);\n\n  /**\n   * @notice Immutable cap for `maxBaseRateChangePips`.\n   * @return _maxBaseRateChangePipsCap Immutable max change cap.\n   */\n  function MAX_BASE_RATE_CHANGE_PIPS_CAP() external view returns (uint24 _maxBaseRateChangePipsCap);\n\n  /**\n   * @notice Immutable minimum cooldown.\n   * @return _minBaseRateUpdateCooldown Minimum base rate update cooldown.\n   */\n  function MIN_BASE_RATE_UPDATE_COOLDOWN() external view returns (uint48 _minBaseRateUpdateCooldown);\n\n  /**\n   * @notice Immutable maximum cooldown.\n   * @return _maxBaseRateUpdateCooldown Maximum base rate update cooldown.\n   */\n  function MAX_BASE_RATE_UPDATE_COOLDOWN() external view returns (uint48 _maxBaseRateUpdateCooldown);\n\n  /**\n   * @notice Immutable floor band cap.\n   * @return _maxBandFloorPips Maximum floor band in pips.\n   */\n  function MAX_BAND_FLOOR_PIPS() external view returns (uint24 _maxBandFloorPips);\n\n  /**\n   * @notice Immutable ceiling band cap.\n   * @return _maxBandCeilingPips Maximum ceiling band in pips.\n   */\n  function MAX_BAND_CEILING_PIPS() external view returns (uint24 _maxBandCeilingPips);\n\n  /**\n   * @notice Current base emission rate.\n   * @return _baseRate Base emission rate.\n   */\n  function baseRate() external view returns (uint232 _baseRate);\n\n  /**\n   * @notice Current operator address.\n   * @return _operator Operator address.\n   */\n  function operator() external view returns (address _operator);\n\n  /**\n   * @notice Timestamp at which the next base rate update can execute.\n   * @return _nextBaseRateUpdate Next accepted base rate update timestamp.\n   */\n  function nextBaseRateUpdate() external view returns (uint48 _nextBaseRateUpdate);\n\n  /**\n   * @notice Current FED address.\n   * @return _fed FED address.\n   */\n  function fed() external view returns (address _fed);\n\n  /**\n   * @notice Current base rate update cooldown.\n   * @return _baseRateUpdateCooldown Base rate update cooldown.\n   */\n  function baseRateUpdateCooldown() external view returns (uint48 _baseRateUpdateCooldown);\n\n  /**\n   * @notice Current maximum base rate change.\n   * @return _maxBaseRateChangePips Maximum base rate change in pips.\n   */\n  function maxBaseRateChangePips() external view returns (uint24 _maxBaseRateChangePips);\n\n  /**\n   * @notice Current team mint share.\n   * @return _teamRate Team mint share in pips.\n   */\n  function teamRate() external view returns (uint24 _teamRate);\n\n  /**\n   * @notice Current floor band.\n   * @return _bandFloorPips Floor band in pips.\n   */\n  function bandFloorPips() external view returns (uint24 _bandFloorPips);\n\n  /**\n   * @notice Current ceiling band.\n   * @return _bandCeilingPips Ceiling band in pips.\n   */\n  function bandCeilingPips() external view returns (uint24 _bandCeilingPips);\n\n  /**\n   * @notice Current dynamic rate module authorized to push the dynamic rate.\n   * @return _dynamicRateModule Dynamic rate module address.\n   */\n  function dynamicRateModule() external view returns (address _dynamicRateModule);\n\n  /**\n   * @notice Current dynamic emission rate target, stored raw before band clamping. Zero means no target is in\n   * effect and the emission rate is the base rate.\n   * @return _dynamicRate Stored dynamic emission rate target.\n   */\n  function dynamicRate() external view returns (uint256 _dynamicRate);\n\n  /**\n   * @notice Cumulative recipient emissions cap accrued as of `lastCapUpdate`.\n   * @dev Not re-accrued on read, so it lags the live value by the segment since `lastCapUpdate`; `mint` accrues the\n   * elapsed segment before checking `emissionsMinted` against it, so the cap is exact at mint time.\n   * @return _emissionsCap Accrued emissions cap.\n   */\n  function emissionsCap() external view returns (uint256 _emissionsCap);\n\n  /**\n   * @notice Timestamp the emissions cap was last accrued. Initialized to `ACTIVATION_TIMESTAMP`.\n   * @return _lastCapUpdate Last cap accrual timestamp.\n   */\n  function lastCapUpdate() external view returns (uint48 _lastCapUpdate);\n\n  /**\n   * @notice Total TOKEN minted to redeem recipients, excluding team shares.\n   * @return _emissionsMinted Cumulative recipient minting.\n   */\n  function emissionsMinted() external view returns (uint256 _emissionsMinted);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},"V3/src/interfaces/factories/ICLFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title ICLFactory\n/// @notice Concentrated-liquidity factory functions used by the dynamic swap fee hook and the Metarouter's CL\n///         position commands.\ninterface ICLFactory {\n  /// @notice Returns the manager authorized to configure swap fees.\n  function swapFeeManager() external view returns (address);\n\n  /// @notice Returns whether an address is a pool created by the factory.\n  function isPool(address _pool) external view returns (bool);\n\n  /// @notice Returns the default fee for a tick spacing.\n  function tickSpacingToFee(int24 _tickSpacing) external view returns (uint24);\n\n  /// @notice Returns the discount registry.\n  function discountRegistry() external view returns (address);\n\n  /// @notice Returns the concentrated-liquidity pool tape.\n  function clPoolTape() external view returns (address);\n\n  /// @notice Returns the canonical position manager issuing positions for this factory's pools.\n  /// @dev Immutable and nonzero upstream, paired with the manager's own `factory` getter. Returned as an `address` to\n  ///      mirror the upstream ABI and keep this interface free of a position-manager import.\n  /// @return The nonfungible position manager paired with this factory.\n  function positionManager() external view returns (address);\n}\n"},"V3/src/interfaces/factories/ICLGaugeFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title ICLGaugeFactory\n/// @notice Concentrated-liquidity gauge factory functions used by the Metarouter's position manager resolution.\ninterface ICLGaugeFactory {\n  /// @notice Address of the NonfungiblePositionManager used to create nfts that gauges will accept\n  /// @dev Immutable and nonzero upstream, set to the manager of the CL factory the gauge factory serves. Returned as\n  ///      an `address` to mirror the upstream ABI and keep this interface free of a position-manager import.\n  /// @return The nonfungible position manager the factory's gauges accept.\n  function nft() external view returns (address);\n}\n"},"node_modules/@openzeppelin/contracts/utils/Panic.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n *      using Panic for uint256;\n *\n *      // Use any of the declared internal constants\n *      function foo() { Panic.GENERIC.panic(); }\n *\n *      // Alternatively\n *      function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n    /// @dev generic / unspecified error\n    uint256 internal constant GENERIC = 0x00;\n    /// @dev used by the assert() builtin\n    uint256 internal constant ASSERT = 0x01;\n    /// @dev arithmetic underflow or overflow\n    uint256 internal constant UNDER_OVERFLOW = 0x11;\n    /// @dev division or modulo by zero\n    uint256 internal constant DIVISION_BY_ZERO = 0x12;\n    /// @dev enum conversion error\n    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n    /// @dev invalid encoding in storage\n    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n    /// @dev empty array pop\n    uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n    /// @dev array out of bounds access\n    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n    /// @dev resource error (too large allocation or too large array)\n    uint256 internal constant RESOURCE_ERROR = 0x41;\n    /// @dev calling invalid internal function\n    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n    /// @dev Reverts with a panic code. Recommended to use with\n    /// the internal constants with predefined codes.\n    function panic(uint256 code) internal pure {\n        assembly (\"memory-safe\") {\n            mstore(0x00, 0x4e487b71)\n            mstore(0x20, code)\n            revert(0x1c, 0x24)\n        }\n    }\n}\n"},"V3/src/interfaces/external/ICrossCollateralTokenRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ITokenRouter} from 'V3/interfaces/external/ITokenRouter.sol';\n\n/**\n * @title ICrossCollateralTokenRouter\n * @notice Hyperlane ERC20 collateral route supporting an explicitly selected destination token router.\n * @dev Mirrors `CrossCollateralRouter` from `@hyperlane-xyz/core@11.3.1` (hyperlane-monorepo commit\n *      `49bdf9c6bd978a56aa308f07170a6e160fdf7469`) without importing it; the pinned 10.1.3 dependency predates it.\n *      The asset router is independent of the final beneficiary and the destination interchain account router.\n */\ninterface ICrossCollateralTokenRouter is ITokenRouter {\n  /**\n   * @notice Transfers collateral to a beneficiary through the selected enrolled destination token router.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Final beneficiary on the destination domain.\n   * @param _amount Amount in source collateral token units.\n   * @param _targetRouter Destination token router receiving the transfer message.\n   * @return _messageId Identifier of the dispatched Hyperlane message.\n   */\n  function transferRemoteTo(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount,\n    bytes32 _targetRouter\n  ) external payable returns (bytes32 _messageId);\n\n  /**\n   * @notice Quotes the collateral and messaging payments for the same explicitly selected route as the transfer.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Final beneficiary on the destination domain.\n   * @param _amount Amount in source collateral token units.\n   * @param _targetRouter Destination token router receiving the transfer message.\n   * @return _quotes Required payments, which may contain multiple entries in the same denomination.\n   */\n  function quoteTransferRemoteTo(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount,\n    bytes32 _targetRouter\n  ) external view returns (Quote[] memory _quotes);\n\n  /**\n   * @notice Returns the origin Hyperlane domain used to distinguish remote from synchronous local transfers.\n   * @return _domain Origin Hyperlane domain.\n   */\n  function localDomain() external view returns (uint32 _domain);\n}\n"},"V3/src/interfaces/external/ITokenRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title ITokenRouter\n * @notice Minimal view of a Hyperlane warp route (`TokenRouter`) used by the Metarouter's bridge command: the\n *         value-transfer and quote surface plus the managed-token accessor.\n * @dev Hyperlane bundles `ITokenFee`/`ITokenBridge` in one file and declares `token()` only on the abstract\n *      `TokenRouter` contract, so the selectors the command needs are mirrored here as one self-contained interface\n *      instead of importing the bundled file.\n */\ninterface ITokenRouter {\n  /**\n   * @notice A token amount to approve and/or send for a transfer, as reported by `quoteTransferRemote`.\n   * @param token Token to approve or send; the zero address denotes the native token.\n   * @param amount Amount of `token` the transfer requires.\n   */\n  struct Quote {\n    address token;\n    uint256 amount;\n  }\n\n  /**\n   * @notice Transfers `_amount` of the managed token to `_recipient` on `_destination`.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Recipient on the destination domain, as bytes32.\n   * @param _amount Amount to transfer.\n   * @return _messageId Hyperlane message id of the transfer.\n   */\n  function transferRemote(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount\n  ) external payable returns (bytes32 _messageId);\n\n  /**\n   * @notice Quotes the tokens to approve and/or send to transfer `_amount` to `_recipient` on `_destination`.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Recipient on the destination domain, as bytes32.\n   * @param _amount Amount to transfer.\n   * @return _quotes Tokens and amounts the transfer requires.\n   */\n  function quoteTransferRemote(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount\n  ) external view returns (Quote[] memory _quotes);\n\n  /**\n   * @notice Returns the token the warp route manages.\n   * @dev Per Hyperlane's `TokenRouter`: the collateral ERC20 for a collateral route, `address(this)` for a synthetic\n   *      route, or the zero address for a native route.\n   * @return _token The managed token address.\n   */\n  function token() external view returns (address _token);\n}\n"},"V3/src/interfaces/governor/IGovernor.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title  IGovernor\n * @notice Minimal surface of the tokenId-keyed Governor the Relay forwards fractional votes to. The\n *         real Governor (GovernorSimple + fractional counting) exposes far more; the Relay only needs\n *         the proposal snapshot and the parameterized cast.\n */\ninterface IGovernor {\n  /**\n   * @notice Cast a vote for `_tokenId` with a reason and counting-module params (fractional support).\n   * @param _proposalId Proposal being voted on.\n   * @param _tokenId sAERO whose voting power backs the cast; the caller must be its owner or approved.\n   * @param _support Counting-module support: 0 Against, 1 For, 2 Abstain, 255 fractional.\n   * @param _reason Free-form reason string attached to the cast.\n   * @param _params Counting-module params; for fractional support, three packed `uint128` weights\n   *        (against, for, abstain).\n   * @return _weight Voting weight the Governor consumed for this cast.\n   */\n  function castVoteWithReasonAndParams(\n    uint256 _proposalId,\n    uint256 _tokenId,\n    uint8 _support,\n    string calldata _reason,\n    bytes memory _params\n  ) external returns (uint256 _weight);\n\n  /**\n   * @notice Timepoint (EIP-6372 timestamp mode) at which voting power for a proposal is snapshotted.\n   * @param _proposalId Proposal being queried.\n   * @return _snapshot The proposal's snapshot timestamp.\n   */\n  function proposalSnapshot(uint256 _proposalId) external view returns (uint256 _snapshot);\n}\n"},"V3/src/interfaces/relay/IRelayToken.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title  IRelayToken\n * @notice Satellite ERC-20 the Relay clones twice at initialization: once as the principal token\n *         (PT, the priced position carrying the withdraw right) and once as the yield token (YT,\n *         the balance the reward accumulator reads). Mint and burn are Relay-only; holder transfers\n *         are gated by the per-clone `transferable` switch.\n * @dev    Includes the duplicated ERC-20 slice the Relay consumes (`balanceOf`, `totalSupply`) —\n *         duplicated-slice interfaces are accepted repo precedent, see IRelayEntrypoint's dev note.\n */\ninterface IRelayToken {\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                  CUSTOM ERRORS                                     __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Thrown when `mint` or `burn` is called by anyone other than the bound Relay.\n  error NotRelay();\n\n  /// @notice Thrown on `transfer`/`transferFrom` when the clone was initialized as\n  ///         non-transferable (soulbound).\n  error TokenNotTransferable();\n\n  /// @notice Thrown when a transfer names the zero address, or a share mint names the Relay or a satellite.\n  error InvalidRecipient();\n\n  /// @notice Thrown when `initialize` runs a second time, or on the implementation itself.\n  error AlreadyInitialized();\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                    FUNCTIONS                                       __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Initialize a freshly cloned satellite: bind the calling Relay and store the metadata.\n  /// @param _name ERC-20 name, stored per clone; no setter.\n  /// @param _symbol ERC-20 symbol, stored per clone; no setter.\n  /// @param _transferable Whether holder-to-holder transfers are allowed. Immutable switch: set\n  ///        once here, no setter.\n  /// @dev The Relay clones the token inside its own `initialize`, so `msg.sender` is the Relay by\n  ///      construction. Callable once; the implementation's constructor marks itself initialized.\n  function initialize(string calldata _name, string calldata _symbol, bool _transferable) external;\n\n  /// @notice Mint `_amount` tokens to `_to`. Relay-only.\n  /// @param _to Recipient of the minted tokens.\n  /// @param _amount Token amount to mint.\n  function mint(address _to, uint256 _amount) external;\n\n  /// @notice Burn `_amount` tokens from `_from`. Relay-only.\n  /// @param _from Holder whose tokens burn.\n  /// @param _amount Token amount to burn.\n  function burn(address _from, uint256 _amount) external;\n\n  /// @notice The Relay this satellite is bound to: the only authorized mint/burn caller, the\n  ///         target of the balance-change hook and a banned transfer recipient.\n  /// @return _relay The Relay address.\n  function relay() external view returns (address _relay);\n\n  /// @notice Whether holder-to-holder transfers are allowed. Immutable switch: set once at\n  ///         initialization, no setter.\n  /// @return _transferable True when the token is transferable, false when soulbound.\n  function transferable() external view returns (bool _transferable);\n\n  /// @notice The token balance of `_owner`.\n  /// @param _owner Holder to read.\n  /// @return _balance The holder's current balance.\n  function balanceOf(address _owner) external view returns (uint256 _balance);\n\n  /// @notice The total token supply.\n  /// @return _totalSupply The current total supply.\n  function totalSupply() external view returns (uint256 _totalSupply);\n}\n\n/**\n * @title  IRelayTokenHook\n * @notice The Relay-side callback every RelayToken balance change reports to, fired BEFORE any\n *         balance mutates so the Relay's reward settle reads pre-change balances.\n * @dev    Declared alongside IRelayToken as the token's minimal expectation of its Relay; the\n *         Relay implements it and authenticates the caller against its own satellite addresses.\n */\ninterface IRelayTokenHook {\n  /// @notice Reacts to an imminent balance change on a satellite token: authorizes the move and\n  ///         settles reward accrual against the pre-change balances.\n  /// @dev The tier seam behind this hook can narrow the recipients further, as Protocol does.\n  /// @param _from Sender (zero on mint).\n  /// @param _to Recipient (zero on burn).\n  /// @param _amount Token amount about to move.\n  function onRelayTokenTransfer(address _from, address _to, uint256 _amount) external;\n}\n"},"V3/src/interfaces/relay/IRelayVoteAdapter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title  IRelayVoteAdapter\n * @notice Translates the Relay's canonical cast — an (against, for, abstain) split — into the\n *         Governor's ABI, so a Governor upgrade is an adapter swap instead of a Relay redeploy.\n * @dev    Consulted by STATICCALL only and MUST hold no storage (immutables are fine): the EVM then\n *         guarantees an adapter cannot write, log or reenter. The adapter never names the call\n *         target — the Relay sends the returned calldata to its own stored Governor, and only when\n *         its selector is the fractional cast — so a hostile adapter can miscode a vote but never\n *         make the Relay call anything else as itself. `proposalSnapshot`\n *         MUST return a timestamp (the PT and VE checkpoint clock); an adapter for a block-number\n *         Governor must convert.\n */\ninterface IRelayVoteAdapter {\n  /// @notice Thrown when a split component does not fit the width the Governor dialect encodes.\n  error UnrepresentableWeight();\n\n  /// @notice The timepoint `_governor` snapshots voting power at for `_proposalId`.\n  /// @param _governor Governor the proposal lives on.\n  /// @param _proposalId Proposal being queried.\n  /// @return _timestamp The proposal's snapshot timestamp.\n  function proposalSnapshot(address _governor, uint256 _proposalId) external view returns (uint256 _timestamp);\n\n  /// @notice Encode one partial cast into the Governor dialect.\n  /// @param _proposalId Proposal being voted on.\n  /// @param _tokenId The Relay's sAERO whose weight backs the cast.\n  /// @param _against Weight cast against.\n  /// @param _for Weight cast in favor.\n  /// @param _abstain Weight cast as abstention.\n  /// @param _reason Free-form reason string to attach.\n  /// @return _callData Calldata the Relay sends to its stored Governor, verbatim.\n  function encodeCast(\n    uint256 _proposalId,\n    uint256 _tokenId,\n    uint256 _against,\n    uint256 _for,\n    uint256 _abstain,\n    string calldata _reason\n  ) external view returns (bytes memory _callData);\n}\n"},"V3/src/interfaces/vpm/IVoterPaymentsModule.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\nimport {IGuardedAccessControlEnumerable} from 'V3/interfaces/access/IGuardedAccessControlEnumerable.sol';\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\n\n/// @title VoterPaymentsModule interface\n/// @notice Full surface of a VoterPaymentsModule: the user-facing operations VotingEscrow gates on, plus the fee map,\n///         restricted map, role management, and admin entry points. Implementations advertise this interface via\n///         ERC-165 and are granted VPM_ROLE on the VotingEscrow to be authorized.\ninterface IVoterPaymentsModule is IERC165, IGuardedAccessControlEnumerable {\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Dependencies and initial fee-management role holders.\n  /// @param votingEscrow Voting escrow mediated by the module, which may be a predicted address.\n  /// @param feeManagerAdmin Address granted FEE_MANAGER_ADMIN_ROLE.\n  /// @param feeManager Address granted FEE_MANAGER.\n  struct ConstructorParams {\n    address votingEscrow;\n    address feeManagerAdmin;\n    address feeManager;\n  }\n\n  /// @notice Per-caller fee record for a given operation signature.\n  /// @param registered Always true for a written record; distinguishes a stored entry from an absent (zero) one.\n  /// @param rateInPips Caller's rate in pips. Honored only when `registered` is true and the value is\n  ///                   below the default rate stored at `fees[sig][address(0)]`.\n  struct CallerInfo {\n    bool registered;\n    uint128 rateInPips;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Emitted at the end of `depositIntoNFT`.\n  /// @param caller Address that invoked the operation.\n  /// @param sources Source deltas submitted to VE.\n  /// @param destinationId Resolved destination token id (mint sentinels replaced by the assigned id).\n  /// @param totalIn Sum of source amounts before fee.\n  /// @param fee Amount routed to the protocol accumulator.\n  event DepositedIntoNFT(\n    address indexed caller,\n    IVotingEscrow.SourceDelta[] sources,\n    uint256 indexed destinationId,\n    uint256 totalIn,\n    uint256 fee\n  );\n\n  /// @notice Emitted at the end of `withdrawToNFT`.\n  /// @param caller Address that invoked the operation.\n  /// @param sourceId Source token id whose stake was reduced.\n  /// @param destinations Destination deltas as supplied by the caller (before fee trim).\n  /// @param totalOut Sum of caller-supplied destination amounts.\n  /// @param fee Amount routed to the protocol accumulator.\n  event WithdrawnToNFT(\n    address indexed caller,\n    uint256 indexed sourceId,\n    IVotingEscrow.DestinationDelta[] destinations,\n    uint256 totalOut,\n    uint256 fee\n  );\n\n  /// @notice Emitted whenever a fee record is written via `setFee`.\n  /// @param sig Operation selector that the entry applies to.\n  /// @param caller Address whose record was updated. address(0) is the default slot.\n  /// @param info Stored CallerInfo built from the supplied rate; `registered` is always true for a written record.\n  event FeeSet(bytes4 indexed sig, address indexed caller, CallerInfo info);\n\n  /// @notice Emitted when a caller's fee record is cleared via `removeFee`.\n  /// @param sig Operation selector whose record was cleared.\n  /// @param caller Address whose record was removed.\n  event FeeRemoved(bytes4 indexed sig, address indexed caller);\n\n  /// @notice Emitted whenever the restricted mode of an operation is toggled via `setRestricted`.\n  /// @param sig Operation selector that was toggled.\n  /// @param value New value of the restricted flag.\n  event RestrictedSet(bytes4 indexed sig, bool value);\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when a constructor argument is the zero address.\n  error ZeroAddress();\n\n  /// @notice Thrown when the caller is not authorized over a source tokenId.\n  /// @param tokenId Token id whose authorization check failed.\n  error NotApprovedByOwner(uint256 tokenId);\n\n  /// @notice Thrown when `depositIntoNFT` is called with an empty sources array.\n  error NoSources();\n\n  /// @notice Thrown when `withdrawToNFT` is called with an empty destinations array.\n  error NoDestinations();\n\n  /// @notice Thrown when `withdrawToNFT` is called with destination amounts summing to zero.\n  error ZeroWithdraw();\n\n  /// @notice Thrown when `withdrawToNFT` has a nonzero total but every destination trims to zero.\n  error AllDestinationsTrimmedToZero();\n\n  /// @notice Thrown when `setFee` is called with a rate higher than `MAX_PIPS` (100%).\n  error InvalidFeeRate();\n\n  /// @notice Thrown when an operation is restricted and the caller is not registered.\n  error NotRegistered();\n\n  /// @notice Thrown when `removeFee` targets the default slot (address(0)), which is managed only via `setFee`.\n  error CannotRemoveDefault();\n\n  /// @notice Thrown when a `depositIntoNFT` mint-sentinel destination would mint a zero-stake NFT.\n  error ZeroMintAmount();\n\n  /*//////////////////////////////////////////////////////////////\n                       USER-FACING OPERATIONS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Move staking weight from one or more source sAEROs into a destination sAERO.\n  /// @dev A zero-amount source is skipped on the Voter chain0 mirror, but VE still folds its unlock into the\n  ///      source-end check: a zero-amount permanent source forces `type(uint48).max` and reverts `UnlockTimeReduction`\n  ///      against any non-permanent destination, so it is not a universal no-op.\n  /// @dev Every source must have voted at least once and hold at least its delta amount idle on chain0,\n  ///      or the Voter reverts `InsufficientChain0Allocation`. Vote or reset the source first.\n  /// @param _sources Per-source deltas describing the amount taken from each source tokenId.\n  /// @param _destinationId Destination tokenId, or type(uint256).max to mint a fresh sAERO to _recipient.\n  /// @param _recipient Owner of the freshly minted sAERO when _destinationId is the mint sentinel; ignored otherwise.\n  /// @return _mintedIds Token ids assigned by VE for each mint sentinel resolved during the call.\n  function depositIntoNFT(\n    IVotingEscrow.SourceDelta[] calldata _sources,\n    uint256 _destinationId,\n    address _recipient\n  ) external returns (uint256[] memory _mintedIds);\n\n  /// @notice Move staking weight from a single source sAERO into one or more destinations.\n  /// @dev The source must have voted at least once and hold at least the total withdrawn amount idle on\n  ///      chain0, or the Voter reverts `InsufficientChain0Allocation`. Vote or reset the source first.\n  /// @dev A destination equal to the source is not rejected: its source and destination legs net out on both VE\n  ///      and the Voter's chain0 ledger, leaving only the fee leg as a real move; a trim that rounds to zero is a\n  ///      no-op whose amount falls into the fee leg. Either way the caller burns gas (and the fee) for no net change.\n  /// @dev Only a mint leg (`tokenId == type(uint256).max`) may carry a nonzero `recipient`; every other destination\n  ///      must leave it zero, or the call reverts `IVotingEscrow.NonMintRecipientNotAllowed`. This keeps the emitted\n  ///      `WithdrawnToNFT` destinations canonical, mirroring the guard `rebalanceUnderlying` already enforces.\n  /// @param _sourceId Source tokenId from which weight is removed.\n  /// @param _destinations Per-destination deltas, including any caller-supplied accumulator entries.\n  /// @return _mintedIds Token ids assigned by VE for each mint sentinel resolved during the call.\n  function withdrawToNFT(\n    uint256 _sourceId,\n    IVotingEscrow.DestinationDelta[] calldata _destinations\n  ) external returns (uint256[] memory _mintedIds);\n\n  /*//////////////////////////////////////////////////////////////\n                            FEE / ROLE ADMIN\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Write a fee record for an operation.\n  /// @dev Stores `{registered: true, rateInPips: _rateInPips}`; reverts `InvalidFeeRate` when `_rateInPips > MAX_PIPS`.\n  /// @param _sig Operation selector that the record applies to.\n  /// @param _caller Caller address whose record is updated. address(0) targets the operation default.\n  /// @param _rateInPips Rate in pips to store for the caller.\n  function setFee(bytes4 _sig, address _caller, uint128 _rateInPips) external;\n\n  /// @notice Toggle whether unregistered callers can initiate an operation.\n  /// @param _sig Operation selector whose restricted flag is updated.\n  /// @param _value New value of the flag.\n  function setRestricted(bytes4 _sig, bool _value) external;\n\n  /// @notice Clear a caller's fee record for an operation, dropping the caller back to the default rate.\n  /// @dev Fee-override cleanup only, not an access lever. Reverts `CannotRemoveDefault` for the default\n  ///      slot (address(0)) and `NotRegistered` when there is no record; succeeds regardless of the\n  ///      operation's restricted flag.\n  /// @param _sig Operation selector whose record is cleared.\n  /// @param _caller Caller address whose record is removed.\n  function removeFee(bytes4 _sig, address _caller) external;\n\n  /*//////////////////////////////////////////////////////////////\n                                CONSTANTS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Role required to write the fee map and toggle restricted mode.\n  function FEE_MANAGER() external view returns (bytes32 _role);\n\n  /// @notice Role-admin for FEE_MANAGER.\n  function FEE_MANAGER_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice VE tokenId of the protocol-owned accumulator that collects fees on the chain0 ledger.\n  function FEE_ACCUMULATOR_ID() external view returns (uint256 _tokenId);\n\n  /*//////////////////////////////////////////////////////////////\n                               IMMUTABLES\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Voting escrow this VPM mediates.\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /*//////////////////////////////////////////////////////////////\n                              STATE GETTERS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Per-operation, per-caller fee record.\n  /// @param _sig Operation selector.\n  /// @param _caller Caller address. address(0) is the default slot.\n  /// @return _registered True if the caller has a stored record.\n  /// @return _rateInPips Caller's stored rate.\n  function fees(bytes4 _sig, address _caller) external view returns (bool _registered, uint128 _rateInPips);\n\n  /// @notice Per-operation restricted flag. When true, only registered callers can initiate the operation.\n  /// @param _sig Operation selector.\n  /// @return _restricted Current value of the flag.\n  function restricted(bytes4 _sig) external view returns (bool _restricted);\n\n  /// @notice Resolve the effective rate a caller would pay for an operation.\n  /// @dev Reverts with NotRegistered when the operation is restricted and the caller is not registered.\n  /// @param _sig Operation selector.\n  /// @param _caller Caller address.\n  /// @return _rateInPips Effective rate the caller would be charged.\n  function getFee(bytes4 _sig, address _caller) external view returns (uint128 _rateInPips);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC721.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC721.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC721} from \"../token/ERC721/IERC721.sol\";\n"},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also applies here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},"V3/src/interfaces/token/ITokenExtensions.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IBaseTokenExtensions} from 'V3/interfaces/token/IBaseTokenExtensions.sol';\n\n/// @title ITokenExtensions\n/// @notice Interface for Token custom behavior not covered by the ERC20 interface.\ninterface ITokenExtensions is IBaseTokenExtensions {\n  /// @notice Thrown when a caller other than the minter tries to mint tokens.\n  error NotMinter();\n\n  /// @notice Thrown when a caller without burn permission tries to burn tokens.\n  error CallerNotBurner();\n\n  /// @notice Mints tokens to an account.\n  /// @param _to The account that receives the minted tokens.\n  /// @param _amount The amount of tokens to mint.\n  function mint(address _to, uint256 _amount) external;\n\n  /// @notice Burns tokens held by an authorized protocol burner.\n  /// @param _amount The amount of tokens to burn.\n  function burn(uint256 _amount) external;\n\n  /// @notice Returns the minter address.\n  /// @return _minter The address allowed to mint tokens.\n  function MINTER() external view returns (address _minter);\n\n  /// @notice Returns the voting escrow address.\n  /// @return _votingEscrow The address allowed to burn tokens.\n  function VOTING_ESCROW() external view returns (address _votingEscrow);\n\n  /// @notice Returns the Aerodrome migration address.\n  /// @return _migration The Aerodrome migration pre-mint recipient and burner.\n  function MIGRATION() external view returns (address _migration);\n\n  /// @notice Returns the Velodrome migration entrypoint address.\n  /// @return _velodromeMigration The Velodrome pre-mint recipient and burner.\n  function VELODROME_MIGRATION() external view returns (address _velodromeMigration);\n}\n"},"V3/src/interfaces/bridge/IMessageAdapter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IMessageAdapter\n * @notice Interface for transport adapters that carry payloads between `MessageOrchestrator` instances without\n * inspecting their content.\n */\ninterface IMessageAdapter {\n  /// @notice Thrown when `sendMessage` is invoked by a caller that is not a registered orchestrator.\n  error CallerNotOrchestrator();\n\n  /// @notice Thrown when the adapter is constructed with a zero chain id.\n  error InvalidChainId();\n\n  /// @notice Thrown when a required address argument is the zero address.\n  error ZeroAddress();\n\n  /**\n   * @notice Sends the payload through the transport.\n   * @dev Callable only by the registered orchestrator. Forwards `msg.value` to the underlying transport as the fee.\n   * Any excess over the actual fee is expected to be refunded by the transport directly to `_refundRecipient`.\n   * @param _message The wrapped message body forwarded to the underlying transport.\n   * @param _gasLimit Execution gas reserved for the destination handler.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function sendMessage(bytes calldata _message, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /**\n   * @notice Transport entrypoint invoked by the underlying transport to deliver an inbound payload to the local\n   * orchestrator.\n   * @dev Implementations that carry an underlying transport validate the transport caller, the origin, and the\n   * sender against their configured remote counterpart, then call the orchestrator with `REMOTE_CHAIN_ID` as the\n   * source chain id. Implementations without a transport (e.g., `RootLocalAdapter`) may revert.\n   * @dev Payable: the transport forwards the relayer's delivery value (Hyperlane's `Mailbox.process` attaches\n   * `msg.value` to `handle`), and the adapter passes it through to `route`, where it lands in the orchestrator's\n   * pre-funding pool.\n   * @param _origin Transport-level identifier of the source chain.\n   * @param _sender Trusted counterpart address as reported by the transport.\n   * @param _message The wrapped message body delivered to the orchestrator's `route`.\n   */\n  function handle(uint32 _origin, bytes32 _sender, bytes calldata _message) external payable;\n\n  /**\n   * @notice Quotes the transport fee `sendMessage` would charge for the same inputs.\n   * @dev Takes the identical arguments to `sendMessage` on purpose: the underlying transport prices the wrapped\n   * message and the destination gas budget together, so a quote taken with different arguments is not the fee\n   * the send will cost. Callers that quote-then-send in the same transaction get an exact figure; the\n   * fee-less local adapter quotes zero.\n   * @param _message The wrapped message body that would be forwarded to the underlying transport.\n   * @param _gasLimit Execution gas that would be reserved for the destination handler.\n   * @param _refundRecipient Address that would receive native ETH refunds from the transport.\n   * @return _fee Native amount `sendMessage` requires for these inputs.\n   */\n  function quoteMessage(\n    bytes calldata _message,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external view returns (uint256 _fee);\n\n  /**\n   * @notice Updates the stored remote adapter address.\n   * @dev Implementations that carry a remote counterpart gate this entrypoint behind the adapter authority and reject\n   * the zero value. Implementations without a remote counterpart (e.g., `RootLocalAdapter`) may revert.\n   * @param _remoteAdapter The new counterpart adapter on the remote chain.\n   */\n  function setRemoteAdapter(bytes32 _remoteAdapter) external;\n\n  /**\n   * @notice Chain id this adapter is bound to. Read by the orchestrator at registration time to verify the\n   * adapter is wired to the chain it is being registered for.\n   * @return _chainId Chain id of the counterpart chain (or the local chain id for the local adapter on root).\n   */\n  function REMOTE_CHAIN_ID() external view returns (uint256 _chainId);\n}\n"},"V3/src/interfaces/bridge/IMessageOrchestrator.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IMessageOrchestrator\n * @notice Shared inbound entrypoint of every orchestrator. Registered adapters call `route`, which checks the caller\n * and the nonce, then hands the body to a typed handler.\n */\ninterface IMessageOrchestrator {\n  /**\n   * @notice Routing identifier stamped into the message header and read to pick the typed handler.\n   * @param None Zero-default guard, rejected at decode so an empty payload cannot pass as the first real type.\n   * @param AllocateChain Root to leaf — sets a tokenId's chain-level VP budget and the chain emissions scalar.\n   * @param AllocateGauge Root to leaf — distributes a chain budget across gauges; cooldown-gated on the leaf.\n   * @param ClaimRewards Root to leaf — claims fee and incentive rewards.\n   * @param Redeem Leaf to root — Redeem.\n   * @param SetOperator Root to leaf — propagates the per-tokenId operator assignment.\n   * @param Deallocate Leaf to root — confirms a tokenId's deallocation so root credits `CHAIN0`.\n   * @param ReduceCooldown Root to leaf — accrues a tokenId's pending cooldown reduction.\n   * @param EmergencyDeallocate Root to leaf — clears a tokenId's gauges and cuts its chain budget by the drained\n   * amount, so a Suspended chain re-syncs when it is next reachable.\n   */\n  enum MessageType {\n    None,\n    AllocateChain,\n    AllocateGauge,\n    ClaimRewards,\n    Redeem,\n    SetOperator,\n    Deallocate,\n    ReduceCooldown,\n    EmergencyDeallocate\n  }\n\n  /// @notice Emitted when an outbound message is handed to a transport adapter and its nonce is stamped.\n  /// @param _chainId Destination chain id.\n  /// @param _chainNonce Outbound nonce stamped on this message.\n  /// @param _msgType Routing identifier carried by the message.\n  event MessageDispatched(uint256 indexed _chainId, uint256 _chainNonce, MessageType _msgType);\n\n  /// @notice Emitted when an inbound message is accepted and its nonce is consumed.\n  /// @param _chainId Source chain id.\n  /// @param _chainNonce Nonce stamped by the source orchestrator.\n  /// @param _msgType Routing identifier carried by the message.\n  event MessageReceived(uint256 indexed _chainId, uint256 _chainNonce, MessageType _msgType);\n\n  /// @notice Reverts when the inbound payload is too short to contain the wrapped header.\n  error InvalidPayload();\n\n  /// @notice Reverts when the inbound message type byte is above the `MessageType` enum range.\n  error InvalidMessageType();\n\n  /// @notice Reverts when the inbound message type byte is the `None` zero value, never a routable type.\n  error NoneMessageType();\n\n  /// @notice Reverts when a supplied address parameter is the zero address.\n  error ZeroAddress();\n\n  /// @notice Reverts when `dispatch` is called and no adapter is registered for the destination.\n  error AdapterNotRegistered();\n\n  /// @notice Reverts when `dispatch` is called by anyone other than the local voter contract.\n  error CallerNotAuthorized();\n\n  /// @notice Reverts when a `MessageType` is not routable in the current direction.\n  error UnsupportedMessageType();\n\n  /// @notice Reverts when `route` is called by anyone other than the registered adapter.\n  error CallerNotAdapter();\n\n  /// @notice Reverts when the inbound `chainNonce` has already been consumed.\n  error NonceAlreadyUsed();\n\n  /// @notice Reverts while the local clock trails the message's `dispatchedAt`; the transport redelivers once it\n  ///         catches up, so a chain resuming from an outage cannot start accrual before the sender booked it.\n  error ClockBehindDispatch();\n\n  /// @notice Reverts when an adapter setter is called without `ADAPTER_CONFIG_ROLE` on the local voter.\n  error CallerNotAdapterAuthority();\n\n  /// @notice Reverts when `setAdapter` is invoked with the zero address.\n  error InvalidAdapter();\n\n  /**\n   * @notice Routes a message delivered by a registered adapter to the orchestrator's typed handler.\n   * @dev Registered adapter only. Nonces are single-use. Root rejects a `Redeem` from a suspended origin but still\n   *      takes a `Deallocate`; the leaf routes while suspended so held root messages keep applying.\n   * @dev `payable` so a relayer can send a deallocation return fee: on the leaf it lands in the pre-funding pool\n   *      that pays the return. Root has no use for inbound value.\n   * @param _originChainId Source chain id, supplied by the adapter from its `REMOTE_CHAIN_ID`.\n   * @param _payload The wrapped message to decode and route.\n   */\n  function route(uint256 _originChainId, bytes calldata _payload) external payable;\n}\n"},"V3/src/interfaces/token/IBaseTokenExtensions.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @title IBaseTokenExtensions\n/// @notice Interface for token custom behavior shared by every protocol token.\ninterface IBaseTokenExtensions {\n  /// @notice Thrown when an address parameter is the zero address.\n  error ZeroAddress();\n}\n"}},"compilation":{"language":"Solidity","compiler":"solc","compilerVersion":"0.8.36+commit.8a079791","compilerSettings":{"viaIR":false,"metadata":{"appendCBOR":true,"bytecodeHash":"ipfs","useLiteralContent":false},"libraries":{"V3/src/metarouter/Metarouter.sol":{"ClaimsLib":"0x8eda4655fd8e6bb3aff3d3f36610b1efec24aa22","StakingLib":"0xe463e88df582c0b7a6d530f85c2c6954fb4f3c00","PaymentsLib":"0xa37042e33c31e41b74bf18f0c1b27000f10e9e13","LiquidityLib":"0x0028a78d20d2d5d230cc4b2a23b90793a95cb691","ClPositionLib":"0x96fa373a6d7930d67accf441529ccf3477405493","CrosschainLib":"0x47a3b182d028d503a6e6cd2bd1b4c11960d12113","StakeRelayLib":"0xff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e"}},"optimizer":{"runs":10000,"enabled":true},"viaSSACFG":false,"evmVersion":"prague","remappings":["forge-std/=node_modules/forge-std/src/","@hyperlane/contracts/=node_modules/@hyperlane-xyz/core/contracts/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable-v4/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable-v4/","@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/","@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/","@openzeppelin4/contracts/=node_modules/@openzeppelin/contracts-v4/","@solady/=node_modules/solady/src/","@nomad-xyz/src/=node_modules/@nomad-xyz/excessively-safe-call/src/","V3/=V3/src/","V3-script/=V3/script/","V3-test/=V3/test/"],"experimental":false},"name":"Metarouter","fullyQualifiedName":"V3/src/metarouter/Metarouter.sol:Metarouter"},"abi":[{"type":"constructor","inputs":[{"name":"_weth","type":"address","internalType":"contract IWETH"},{"name":"_leafVoter","type":"address","internalType":"contract ILeafVoter"},{"name":"_rootVoter","type":"address","internalType":"contract IVoter"},{"name":"_icaRouter","type":"address","internalType":"contract IInterchainAccountRouter"},{"name":"_relayFactoryRegistry","type":"address","internalType":"contract IRelayFactoryRegistry"},{"name":"_factoryRegistry","type":"address","internalType":"contract IFactoryRegistry"},{"name":"_nativeErc20","type":"address","internalType":"contract IERC20"}],"stateMutability":"nonpayable"},{"name":"AmountOverflow","type":"error","inputs":[]},{"name":"BatchNotActive","type":"error","inputs":[]},{"name":"BridgeQuoteExceedsBudget","type":"error","inputs":[{"name":"_quote","type":"uint256","internalType":"uint256"},{"name":"_budget","type":"uint256","internalType":"uint256"}]},{"name":"BridgeTokenMismatch","type":"error","inputs":[]},{"name":"CallbackNotCleared","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"CommandDisabled","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"ContractLocked","type":"error","inputs":[]},{"name":"DirectCallRequired","type":"error","inputs":[]},{"name":"Expired","type":"error","inputs":[]},{"name":"FactoryNotApproved","type":"error","inputs":[]},{"name":"GaugeFactoryMismatch","type":"error","inputs":[{"name":"_gauge","type":"address","internalType":"address"},{"name":"_recordedFactory","type":"address","internalType":"address"},{"name":"_reportedFactory","type":"address","internalType":"address"}]},{"name":"GaugeNotRegistered","type":"error","inputs":[]},{"name":"InFlightNftPresent","type":"error","inputs":[]},{"name":"InsufficientAmount0","type":"error","inputs":[]},{"name":"InsufficientAmount1","type":"error","inputs":[]},{"name":"InsufficientAmountA","type":"error","inputs":[]},{"name":"InsufficientAmountB","type":"error","inputs":[]},{"name":"InsufficientBalance","type":"error","inputs":[{"name":"_asset","type":"address","internalType":"address"}]},{"name":"InsufficientLiquidityMinted","type":"error","inputs":[{"name":"_minimum","type":"uint256","internalType":"uint256"},{"name":"_minted","type":"uint256","internalType":"uint256"}]},{"name":"InvalidAmountOut","type":"error","inputs":[]},{"name":"InvalidBridgeQuote","type":"error","inputs":[]},{"name":"InvalidCallbackCaller","type":"error","inputs":[{"name":"_caller","type":"address","internalType":"address"}]},{"name":"InvalidCallbackDeltas","type":"error","inputs":[]},{"name":"InvalidCommandType","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"InvalidEthSender","type":"error","inputs":[]},{"name":"InvalidGaugeType","type":"error","inputs":[]},{"name":"InvalidHookMetadata","type":"error","inputs":[]},{"name":"InvalidInterchainAccountConfig","type":"error","inputs":[]},{"name":"InvalidNativeErc20Decimals","type":"error","inputs":[]},{"name":"InvalidNftSender","type":"error","inputs":[]},{"name":"InvalidPath","type":"error","inputs":[]},{"name":"InvalidPayer","type":"error","inputs":[]},{"name":"InvalidPips","type":"error","inputs":[{"name":"_pips","type":"uint256","internalType":"uint256"}]},{"name":"InvalidPool","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"InvalidRecipient","type":"error","inputs":[]},{"name":"InvalidReserves","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"InvalidSpendMode","type":"error","inputs":[]},{"name":"InvalidSwapDeltas","type":"error","inputs":[]},{"name":"LengthMismatch","type":"error","inputs":[]},{"name":"NativeBalanceNotCleared","type":"error","inputs":[]},{"name":"NativeTransferFailed","type":"error","inputs":[{"name":"_data","type":"bytes","internalType":"bytes"}]},{"name":"NftNotCleared","type":"error","inputs":[]},{"name":"NftNotInCustody","type":"error","inputs":[]},{"name":"NftNotReceived","type":"error","inputs":[]},{"name":"NftSenderNotCleared","type":"error","inputs":[]},{"name":"NoInFlightNft","type":"error","inputs":[]},{"name":"NotLeaf","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"NotPositionOwner","type":"error","inputs":[]},{"name":"NotRoot","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"PenaltyNotAccepted","type":"error","inputs":[]},{"name":"PoolNotFound","type":"error","inputs":[]},{"name":"PoolNotRegistered","type":"error","inputs":[]},{"name":"PoolTokenMismatch","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"PositionManagerFactoryMismatch","type":"error","inputs":[{"name":"_factory","type":"address","internalType":"address"},{"name":"_positionManager","type":"address","internalType":"address"}]},{"name":"PositionManagerNotConfigured","type":"error","inputs":[{"name":"_factory","type":"address","internalType":"address"}]},{"name":"PreBatchNativeBalanceSpent","type":"error","inputs":[]},{"name":"SafeERC20FailedOperation","type":"error","inputs":[{"name":"token","type":"address","internalType":"address"}]},{"name":"SameDomainCrossCollateralTransfer","type":"error","inputs":[]},{"name":"TokenFeeExceedsAmount","type":"error","inputs":[]},{"name":"TokenFeeExceedsMax","type":"error","inputs":[]},{"name":"TooLittleReceived","type":"error","inputs":[{"name":"_minimum","type":"uint256","internalType":"uint256"},{"name":"_received","type":"uint256","internalType":"uint256"}]},{"name":"TooMuchRequested","type":"error","inputs":[]},{"name":"UnauthorizedRelay","type":"error","inputs":[]},{"name":"UnauthorizedRelayVpm","type":"error","inputs":[]},{"name":"UnexpectedNftSender","type":"error","inputs":[]},{"name":"UnregisteredDomain","type":"error","inputs":[]},{"name":"UnsupportedBridgeFeeToken","type":"error","inputs":[{"name":"_token","type":"address","internalType":"address"}]},{"name":"UnsupportedCrossCollateralToken","type":"error","inputs":[]},{"name":"WethIsNativeErc20","type":"error","inputs":[]},{"name":"ZeroAddress","type":"error","inputs":[]},{"name":"ZeroAmount","type":"error","inputs":[]},{"name":"BatchExecuted","type":"event","inputs":[{"name":"_sender","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"name":"EMISSION_TOKEN","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IERC20"}],"stateMutability":"view"},{"name":"FACTORY_REGISTRY","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IFactoryRegistry"}],"stateMutability":"view"},{"name":"ICA_ROUTER","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IInterchainAccountRouter"}],"stateMutability":"view"},{"name":"IS_ROOT","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"LEAF_VOTER","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract ILeafVoter"}],"stateMutability":"view"},{"name":"NATIVE_ERC20","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IERC20"}],"stateMutability":"view"},{"name":"NATIVE_ERC20_SCALE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"RELAY_FACTORY_REGISTRY","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IRelayFactoryRegistry"}],"stateMutability":"view"},{"name":"STAKING_ESCROW","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IVotingEscrow"}],"stateMutability":"view"},{"name":"STAKING_TOKEN","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IERC20"}],"stateMutability":"view"},{"name":"WETH","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IWETH"}],"stateMutability":"view"},{"name":"execute","type":"function","inputs":[{"name":"_commands","type":"bytes","internalType":"bytes"},{"name":"_inputs","type":"bytes[]","internalType":"bytes[]"},{"name":"_deadline","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"msgSender","type":"function","inputs":[],"outputs":[{"name":"_sender","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"onERC721Received","type":"function","inputs":[{"name":"","type":"address","internalType":"address"},{"name":"_from","type":"address","internalType":"address"},{"name":"_tokenId","type":"uint256","internalType":"uint256"},{"name":"","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"_selector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"name":"uniswapV3SwapCallback","type":"function","inputs":[{"name":"_amount0Delta","type":"int256","internalType":"int256"},{"name":"_amount1Delta","type":"int256","internalType":"int256"},{"name":"_data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"receive","stateMutability":"payable"}],"metadata":{"compiler":{"version":"0.8.36+commit.8a079791"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"contract IWETH","name":"_weth","type":"address"},{"internalType":"contract ILeafVoter","name":"_leafVoter","type":"address"},{"internalType":"contract IVoter","name":"_rootVoter","type":"address"},{"internalType":"contract IInterchainAccountRouter","name":"_icaRouter","type":"address"},{"internalType":"contract IRelayFactoryRegistry","name":"_relayFactoryRegistry","type":"address"},{"internalType":"contract IFactoryRegistry","name":"_factoryRegistry","type":"address"},{"internalType":"contract IERC20","name":"_nativeErc20","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AmountOverflow","type":"error"},{"inputs":[],"name":"BatchNotActive","type":"error"},{"inputs":[{"internalType":"uint256","name":"_quote","type":"uint256"},{"internalType":"uint256","name":"_budget","type":"uint256"}],"name":"BridgeQuoteExceedsBudget","type":"error"},{"inputs":[],"name":"BridgeTokenMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"CallbackNotCleared","type":"error"},{"inputs":[{"internalType":"uint256","name":"_commandType","type":"uint256"}],"name":"CommandDisabled","type":"error"},{"inputs":[],"name":"ContractLocked","type":"error"},{"inputs":[],"name":"DirectCallRequired","type":"error"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[],"name":"FactoryNotApproved","type":"error"},{"inputs":[{"internalType":"address","name":"_gauge","type":"address"},{"internalType":"address","name":"_recordedFactory","type":"address"},{"internalType":"address","name":"_reportedFactory","type":"address"}],"name":"GaugeFactoryMismatch","type":"error"},{"inputs":[],"name":"GaugeNotRegistered","type":"error"},{"inputs":[],"name":"InFlightNftPresent","type":"error"},{"inputs":[],"name":"InsufficientAmount0","type":"error"},{"inputs":[],"name":"InsufficientAmount1","type":"error"},{"inputs":[],"name":"InsufficientAmountA","type":"error"},{"inputs":[],"name":"InsufficientAmountB","type":"error"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"_minimum","type":"uint256"},{"internalType":"uint256","name":"_minted","type":"uint256"}],"name":"InsufficientLiquidityMinted","type":"error"},{"inputs":[],"name":"InvalidAmountOut","type":"error"},{"inputs":[],"name":"InvalidBridgeQuote","type":"error"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"}],"name":"InvalidCallbackCaller","type":"error"},{"inputs":[],"name":"InvalidCallbackDeltas","type":"error"},{"inputs":[{"internalType":"uint256","name":"_commandType","type":"uint256"}],"name":"InvalidCommandType","type":"error"},{"inputs":[],"name":"InvalidEthSender","type":"error"},{"inputs":[],"name":"InvalidGaugeType","type":"error"},{"inputs":[],"name":"InvalidHookMetadata","type":"error"},{"inputs":[],"name":"InvalidInterchainAccountConfig","type":"error"},{"inputs":[],"name":"InvalidNativeErc20Decimals","type":"error"},{"inputs":[],"name":"InvalidNftSender","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidPayer","type":"error"},{"inputs":[{"internalType":"uint256","name":"_pips","type":"uint256"}],"name":"InvalidPips","type":"error"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"InvalidPool","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"InvalidSpendMode","type":"error"},{"inputs":[],"name":"InvalidSwapDeltas","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"NativeBalanceNotCleared","type":"error"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NftNotCleared","type":"error"},{"inputs":[],"name":"NftNotInCustody","type":"error"},{"inputs":[],"name":"NftNotReceived","type":"error"},{"inputs":[],"name":"NftSenderNotCleared","type":"error"},{"inputs":[],"name":"NoInFlightNft","type":"error"},{"inputs":[{"internalType":"uint256","name":"_commandType","type":"uint256"}],"name":"NotLeaf","type":"error"},{"inputs":[],"name":"NotPositionOwner","type":"error"},{"inputs":[{"internalType":"uint256","name":"_commandType","type":"uint256"}],"name":"NotRoot","type":"error"},{"inputs":[],"name":"PenaltyNotAccepted","type":"error"},{"inputs":[],"name":"PoolNotFound","type":"error"},{"inputs":[],"name":"PoolNotRegistered","type":"error"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"PoolTokenMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_positionManager","type":"address"}],"name":"PositionManagerFactoryMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"PositionManagerNotConfigured","type":"error"},{"inputs":[],"name":"PreBatchNativeBalanceSpent","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SameDomainCrossCollateralTransfer","type":"error"},{"inputs":[],"name":"TokenFeeExceedsAmount","type":"error"},{"inputs":[],"name":"TokenFeeExceedsMax","type":"error"},{"inputs":[{"internalType":"uint256","name":"_minimum","type":"uint256"},{"internalType":"uint256","name":"_received","type":"uint256"}],"name":"TooLittleReceived","type":"error"},{"inputs":[],"name":"TooMuchRequested","type":"error"},{"inputs":[],"name":"UnauthorizedRelay","type":"error"},{"inputs":[],"name":"UnauthorizedRelayVpm","type":"error"},{"inputs":[],"name":"UnexpectedNftSender","type":"error"},{"inputs":[],"name":"UnregisteredDomain","type":"error"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"UnsupportedBridgeFeeToken","type":"error"},{"inputs":[],"name":"UnsupportedCrossCollateralToken","type":"error"},{"inputs":[],"name":"WethIsNativeErc20","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"}],"name":"BatchExecuted","type":"event"},{"inputs":[],"name":"EMISSION_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FACTORY_REGISTRY","outputs":[{"internalType":"contract IFactoryRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ICA_ROUTER","outputs":[{"internalType":"contract IInterchainAccountRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IS_ROOT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LEAF_VOTER","outputs":[{"internalType":"contract ILeafVoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_ERC20","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_ERC20_SCALE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAY_FACTORY_REGISTRY","outputs":[{"internalType":"contract IRelayFactoryRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_ESCROW","outputs":[{"internalType":"contract IVotingEscrow","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_TOKEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_commands","type":"bytes"},{"internalType":"bytes[]","name":"_inputs","type":"bytes[]"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"msgSender","outputs":[{"internalType":"address","name":"_sender","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"_selector","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"_amount0Delta","type":"int256"},{"internalType":"int256","name":"_amount1Delta","type":"int256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}],"devdoc":{"details":"Virtual functions allow future variants to inherit from this contract and override selected behavior.","errors":{"BridgeQuoteExceedsBudget(uint256,uint256)":[{"params":{"_budget":"Native budget resolved for the bridge.","_quote":"Native total the route quotes for the reduced bridge amount."}}],"CallbackNotCleared(address)":[{"params":{"_pool":"Pool still stored as the expected callback caller."}}],"CommandDisabled(uint256)":[{"params":{"_commandType":"Command ID that is disabled on this deployment."}}],"GaugeFactoryMismatch(address,address,address)":[{"params":{"_gauge":"Gauge whose factory identity is inconsistent.","_recordedFactory":"Gauge factory recorded by the FactoryRegistry.","_reportedFactory":"Gauge factory reported by the gauge itself."}}],"InsufficientBalance(address)":[{"params":{"_asset":"ERC20 address, or address(0) for native ETH."}}],"InsufficientLiquidityMinted(uint256,uint256)":[{"params":{"_minimum":"Minimum LP tokens requested by the caller.","_minted":"LP tokens minted by the pool."}}],"InvalidCallbackCaller(address)":[{"params":{"_caller":"Unauthorized callback caller."}}],"InvalidCommandType(uint256)":[{"params":{"_commandType":"Undefined command ID that was dispatched."}}],"InvalidPips(uint256)":[{"params":{"_pips":"Pip value that exceeded the 100% denominator."}}],"InvalidPool(address)":[{"params":{"_pool":"Invalid pool address."}}],"InvalidReserves(address)":[{"params":{"_pool":"Pool with invalid reserves."}}],"NativeTransferFailed(bytes)":[{"params":{"_data":"Revert data returned by the failed low-level call."}}],"NotLeaf(uint256)":[{"params":{"_commandType":"Command ID that is leaf-only."}}],"NotRoot(uint256)":[{"params":{"_commandType":"Command ID that is root-only."}}],"PoolTokenMismatch(address)":[{"params":{"_pool":"Resolved pool address."}}],"PositionManagerFactoryMismatch(address,address)":[{"params":{"_factory":"Factory that named the manager.","_positionManager":"Position manager that failed the reverse-link check."}}],"PositionManagerNotConfigured(address)":[{"params":{"_factory":"Factory whose position manager is unset."}}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC-20 token failed."}],"TooLittleReceived(uint256,uint256)":[{"params":{"_minimum":"Minimum output requested.","_received":"Actual output received."}}],"UnsupportedBridgeFeeToken(address)":[{"params":{"_token":"Address of the unsupported fee token."}}]},"events":{"BatchExecuted(address)":{"params":{"_sender":"Logical sender that owned the completed batch."}}},"kind":"dev","methods":{"constructor":{"details":"The emission token and the staking escrow are derived from the protocol, not passed. On root (this chain      equals the leaf voter's orchestrator `ROOT_CHAIN_ID`) the emission token is the root Voter's `MINTER().TOKEN()`      and the staking escrow is the root Voter's `VOTING_ESCROW()`, the canonical escrow `CREATE_STAKE` and      `DEPOSIT_RELAY` act on; on leaf the emission token is the leaf voter's `RECEIPT_TOKEN` and the staking      immutables stay zero. Derived values come from protocol contracts that validate them at their own      construction, so only the constructor's own inputs are zero-checked here.      A lite deployment ships without the voting system and without the cross-chain layer, so `_leafVoter` and      `_icaRouter` may be zero. A zero voter makes `IS_ROOT` false, leaves the emission token zero, and disables the      gauge staking and claim commands; a zero ICA router disables `EXECUTE_CROSS_CHAIN` and the `BRIDGE_TOKEN`      path that derives a destination interchain account. Those revert with `CommandDisabled` when dispatched,      while a `BRIDGE_TOKEN` naming a direct recipient stays available.","params":{"_factoryRegistry":"Registry used to authenticate recorded pools and CL factories, require factory approval        for pool creation, and resolve permanent factory relationships backing position managers.","_icaRouter":"Interchain account router used by the cross-chain commands. Zero on a lite deployment with no        cross-chain layer, where every command that derives an interchain account is disabled.","_leafVoter":"Leaf Voter used to validate gauge targets and, on leaf, to resolve the emission `ReceiptToken`.        Zero on a lite deployment with no voting system, where the gauge staking and claim commands are disabled.","_nativeErc20":"ERC20 entry point of the chain's native asset, whose spend resolution and closing sweep are        capped so they cannot drain the pre-batch native balance. Zero on a chain whose native asset has no ERC20        entry point. A nonzero native ERC20 must report its decimals: the native-to-token scale is derived from        them, so a native ERC20 expressing the native asset in fewer decimals than native's eighteen converts correctly.","_relayFactoryRegistry":"RelayFactoryRegistry used only on root to authenticate `DEPOSIT_RELAY` relays through        their factory; unused on leaf.","_rootVoter":"Root Voter used only on root to resolve the emission token and the staking escrow; unused on leaf.","_weth":"Wrapped native token used by payment commands. Zero on a chain with no wrapped-native token, where        `WRAP_ETH` and `UNWRAP_WETH` revert with `CommandDisabled`. Never the native ERC20."}},"execute(bytes,bytes[],uint256)":{"params":{"_commands":"One byte per command, index-aligned with `_inputs`.","_deadline":"Timestamp after which the batch reverts.","_inputs":"ABI-encoded arguments for each command."}},"msgSender()":{"returns":{"_sender":"Logical sender for the current batch."}},"onERC721Received(address,address,uint256,bytes)":{"details":"Accepts a position only while a batch is active, and only when the calling collection, the sender, and the      position all match what the active command set through `MetarouterState.setExpectedNft`, then records the      `(collection, tokenId)` pair for the closing ownership check. A CL gauge returns unstaked positions through      `safeTransferFrom`, which is why the router implements the receiver.      This check is the custody boundary. A tracked position is one later commands may operate, so accepting an      unsolicited transfer would let a third party hand the active batch authority over a position it never asked      for. An unset slot reads zero and is rejected outright rather than compared, so a hook call reporting a zero      `_from` cannot slip through while the router expects nothing. Matching the token id too keeps a misbehaving      gauge from returning a different position than the one the command asked back.      The collection is matched rather than compared against a canonical manager: the router holds none, so each      command publishes the manager it resolved. Every argument here except `msg.sender` is chosen by the caller, so      without that comparison any contract could present the expected sender and token id and be recorded as a      custodied collection, and a position from one manager could satisfy state armed for another that issued the      same id."},"uniswapV3SwapCallback(int256,int256,bytes)":{"params":{"_amount0Delta":"Signed token0 amount owed to or sent by the pool.","_amount1Delta":"Signed token1 amount owed to or sent by the pool.","_data":"Callback payer and input authorization encoded by the active swap command."}}},"stateVariables":{"EMISSION_TOKEN":{"return":"The gauge-emissions token this router custodies and sweeps.","returns":{"_0":"The gauge-emissions token this router custodies and sweeps."}},"FACTORY_REGISTRY":{"return":"Factory registry used by venue-sensitive commands.","returns":{"_0":"Factory registry used by venue-sensitive commands."}},"ICA_ROUTER":{"details":"The zero address on a lite deployment with no cross-chain layer, where every command that derives an      interchain account reverts with `CommandDisabled`. A `BRIDGE_TOKEN` naming a direct recipient never reads      this router, so it stays available there.","return":"The interchain account router.","returns":{"_0":"The interchain account router."}},"IS_ROOT":{"details":"Gates the root-only `CREATE_STAKE` and `DEPOSIT_RELAY` commands; derived at construction from whether the      local chain id equals the orchestrator's `ROOT_CHAIN_ID`.","return":"True on the root deployment, false on a leaf.","returns":{"_0":"True on the root deployment, false on a leaf."}},"LEAF_VOTER":{"details":"The zero address on a lite deployment with no voting system, where the gauge staking and claim commands      revert with `CommandDisabled`.","return":"The leaf Voter.","returns":{"_0":"The leaf Voter."}},"NATIVE_ERC20":{"details":"The token's balance is the account's native balance expressed in the token's own decimals, so spend      resolution caps it at the batch's own native converted through `NATIVE_ERC20_SCALE`: spending the full      balance would drain the pre-batch native the batch must preserve and revert the closure.      The closing sweep skips its entry point entirely and returns the batch's portion through the native refund,      since some implementations reject a zero-value `transfer`; a recipient that rejects that refund is paid      through this entry point instead. On implementations that reject value-less transfers the ERC20-style      commands on this token revert mid-batch too; that is the token's own behavior, not the router's.      Never transfer or pre-fund this token ahead of `execute`: provide it as `msg.value` or pull it through      `FUND_ERC20` during the active batch. Value the router already holds when a batch opens counts as pre-batch      native, is excluded from batch custody, and cannot be recovered.","return":"The native ERC20, or the zero address when the chain has none.","returns":{"_0":"The native ERC20, or the zero address when the chain has none."}},"NATIVE_ERC20_SCALE":{"details":"Some chains express the same native asset in different precisions per interface: eighteen decimals for      `address.balance` and `msg.value`, the token's own decimals for `balanceOf` and `transfer`. Every place      that mixes the two representations converts through this factor: the batch's spendable native — less any      committed message fee — converts to the native ERC20 decimals rounding down, so a full spend can never reach the      pre-batch native; a native refund paid through the native ERC20 also floors, leaving dust the token cannot      express. One on an eighteen-decimal native ERC20, where both interfaces share raw values.","return":"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20.","returns":{"_0":"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20."}},"RELAY_FACTORY_REGISTRY":{"return":"The RelayFactoryRegistry, or the zero address on a leaf.","returns":{"_0":"The RelayFactoryRegistry, or the zero address on a leaf."}},"STAKING_ESCROW":{"return":"The VotingEscrow, or the zero address on a leaf.","returns":{"_0":"The VotingEscrow, or the zero address on a leaf."}},"STAKING_TOKEN":{"return":"The staking token, or the zero address on a leaf.","returns":{"_0":"The staking token, or the zero address on a leaf."}},"WETH":{"return":"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled.","returns":{"_0":"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled."}}},"title":"Metarouter","version":1},"userdoc":{"errors":{"AmountOverflow()":[{"notice":"Thrown when an amount cannot be represented as a signed CL swap amount."}],"BatchNotActive()":[{"notice":"Thrown when an inbound asset reaches the router outside a batch."}],"BridgeQuoteExceedsBudget(uint256,uint256)":[{"notice":"Thrown when a native warp route quotes the reduced bridge amount above the resolved budget."}],"BridgeTokenMismatch()":[{"notice":"Thrown when the caller-selected warp route does not manage the token being bridged: the route's `token()`         does not equal the command's token, so it would pull or burn a different asset than the router approved.         Guards an honest token/route mismatch; an untrusted route can still misreport, so this is not route trust."}],"CallbackNotCleared(address)":[{"notice":"Thrown when a CL pool returns without consuming its callback authorization."}],"CommandDisabled(uint256)":[{"notice":"Thrown when a command depends on a protocol contract this deployment was built without."}],"ContractLocked()":[{"notice":"Thrown when an external caller enters `execute()` while a batch is running."}],"DirectCallRequired()":[{"notice":"Thrown when Metarouter is reached through delegatecall instead of a direct call."}],"Expired()":[{"notice":"Thrown when the batch deadline has passed."}],"FactoryNotApproved()":[{"notice":"Thrown when an operation requiring current target-factory approval selects an unapproved factory."}],"GaugeFactoryMismatch(address,address,address)":[{"notice":"Thrown when a gauge reports a factory other than the one permanently recorded for it."}],"GaugeNotRegistered()":[{"notice":"Thrown when a claim or stake targets a gauge not registered with the Voter."}],"InFlightNftPresent()":[{"notice":"Thrown when a producer command would leave a second NFT in flight before the first is consumed."}],"InsufficientAmount0()":[{"notice":"Thrown when a liquidity command's resolved token0 amount falls below its minimum."}],"InsufficientAmount1()":[{"notice":"Thrown when a liquidity command's resolved token1 amount falls below its minimum."}],"InsufficientAmountA()":[{"notice":"Thrown when an add-liquidity command's resolved tokenA amount falls below its minimum."}],"InsufficientAmountB()":[{"notice":"Thrown when an add-liquidity command's resolved tokenB amount falls below its minimum."}],"InsufficientBalance(address)":[{"notice":"Thrown when the execution-address balance cannot cover a spend or minimum floor."}],"InsufficientLiquidityMinted(uint256,uint256)":[{"notice":"Thrown when an add-liquidity command mints fewer LP tokens than requested."}],"InvalidAmountOut()":[{"notice":"Thrown when an exact-output swap delivers a different output than the requested amount."}],"InvalidBridgeQuote()":[{"notice":"Thrown when a caller-selected warp route quotes a total charge below the amount being bridged, which no         honest route reports because the charge covers the delivered amount itself."}],"InvalidCallbackCaller(address)":[{"notice":"Thrown when a caller is not the currently authorized CL pool."}],"InvalidCallbackDeltas()":[{"notice":"Thrown when a callback does not contain exactly one positive token delta."}],"InvalidCommandType(uint256)":[{"notice":"Thrown when a command byte decodes to an undefined command ID."}],"InvalidEthSender()":[{"notice":"Thrown when ETH arrives from an unexpected sender outside a batch."}],"InvalidGaugeType()":[{"notice":"Thrown when position ids are supplied for a gauge that does not support position-level claims."}],"InvalidHookMetadata()":[{"notice":"Thrown when a cross-chain dispatch's hook metadata carries no refund address."}],"InvalidInterchainAccountConfig()":[{"notice":"Thrown when an interchain account configuration names an ISM without a custom destination router."}],"InvalidNativeErc20Decimals()":[{"notice":"Thrown when the native ERC20 reports more decimals than the native asset's eighteen."}],"InvalidNftSender()":[{"notice":"Thrown when an NFT arrives from a collection other than the one the active command solicited."}],"InvalidPath()":[{"notice":"Thrown when a pool path is empty or its adjacent tokens do not connect."}],"InvalidPayer()":[{"notice":"Thrown when a payer is neither the execution address nor the logical sender."}],"InvalidPips(uint256)":[{"notice":"Thrown when a pip spend exceeds 100%."}],"InvalidPool(address)":[{"notice":"Thrown when a pool has no recorded factory, its recorded factory does not authenticate it or differs         from the supplied factory, or its pool family is unsupported for the command."}],"InvalidRecipient()":[{"notice":"Thrown when a payment command names an invalid recipient."}],"InvalidReserves(address)":[{"notice":"Thrown when a V2 pool's token balance is below its recorded input reserve."}],"InvalidSpendMode()":[{"notice":"Thrown when an external pull uses a router-balance spend mode."}],"InvalidSwapDeltas()":[{"notice":"Thrown when a CL swap reports a positive output-token delta."}],"LengthMismatch()":[{"notice":"Thrown when the commands and inputs arrays differ in length."}],"NativeBalanceNotCleared()":[{"notice":"Thrown when the router's native balance differs from its pre-batch balance after the closing refund."}],"NativeTransferFailed(bytes)":[{"notice":"Thrown when a native ETH transfer fails, bubbling the callee's revert data."}],"NftNotCleared()":[{"notice":"Thrown when a tracked NFT still belongs to the router at batch closure."}],"NftNotInCustody()":[{"notice":"Thrown when a command would operate a router-held NFT that did not enter custody during the active batch."}],"NftNotReceived()":[{"notice":"Thrown when a gauge withdrawal returns without delivering the requested position through the receiver."}],"NftSenderNotCleared()":[{"notice":"Thrown when a command would arm an expected NFT sender while another authorization is still pending."}],"NoInFlightNft()":[{"notice":"Thrown when a command references the in-flight NFT but none of the expected collection is in flight."}],"NotLeaf(uint256)":[{"notice":"Thrown when a leaf-only command (redeem) runs on the root deployment."}],"NotPositionOwner()":[{"notice":"Thrown when a CL position command targets a position the logical sender does not own."}],"NotRoot(uint256)":[{"notice":"Thrown when a root-only command (sAERO creation or relay deposit) runs on a leaf deployment."}],"PenaltyNotAccepted()":[{"notice":"Thrown when a routed V2 gauge claim or withdrawal would incur a penalty without explicit user consent."}],"PoolNotFound()":[{"notice":"Thrown when the pair has no pool and the command may not create one."}],"PoolNotRegistered()":[{"notice":"Thrown when a V2 liquidity command or fee claim targets a pool without a FactoryRegistry creation record."}],"PoolTokenMismatch(address)":[{"notice":"Thrown when the factory resolves a pool that does not hold the requested token pair."}],"PositionManagerFactoryMismatch(address,address)":[{"notice":"Thrown when the position manager a factory names does not point back at that factory."}],"PositionManagerNotConfigured(address)":[{"notice":"Thrown when no record names a factory's position manager: the factory getter returns the zero address,         or it reverts and the registry pairs the factory with no gauge factory, or the paired gauge factory         binds the zero address."}],"PreBatchNativeBalanceSpent()":[{"notice":"Thrown when a batch spends native ETH held before that batch started."}],"SameDomainCrossCollateralTransfer()":[{"notice":"Thrown when explicit cross-collateral routing targets the origin domain's synchronous transfer path."}],"TokenFeeExceedsAmount()":[{"notice":"Thrown when a warp route's token fee equals or exceeds the amount being bridged, leaving nothing to         deliver."}],"TokenFeeExceedsMax()":[{"notice":"Thrown when a warp route's token fee exceeds the caller's accepted maximum."}],"TooLittleReceived(uint256,uint256)":[{"notice":"Thrown when an exact-input swap receives less than its minimum."}],"TooMuchRequested()":[{"notice":"Thrown when a swap requires more input than the command authorized."}],"UnauthorizedRelay()":[{"notice":"Thrown when a relay deposit targets an address whose reported factory the RelayFactoryRegistry does not         approve, or which that factory did not create."}],"UnauthorizedRelayVpm()":[{"notice":"Thrown when a relay reports a VoterPaymentsModule the staking escrow does not recognize (it lacks         `VPM_ROLE`), so the router refuses to grant it the operator approval a deposit needs."}],"UnexpectedNftSender()":[{"notice":"Thrown when a position arrives from a sender the active command did not solicit it from."}],"UnregisteredDomain()":[{"notice":"Thrown when a cross-chain dispatch targets a domain with no interchain account router enrolled."}],"UnsupportedBridgeFeeToken(address)":[{"notice":"Thrown when a bridge quote includes a nonzero fee in a token other than the source token or native         currency."}],"UnsupportedCrossCollateralToken()":[{"notice":"Thrown when explicit cross-collateral routing is requested with the zero-address native-token marker."}],"WethIsNativeErc20()":[{"notice":"Thrown when the wrapped native token and the native ERC20 are the same address."}],"ZeroAddress()":[{"notice":"Thrown when a constructor dependency is the zero address."}],"ZeroAmount()":[{"notice":"Thrown when a command resolves a zero asset amount to act on."}]},"events":{"BatchExecuted(address)":{"notice":"Emitted when the outermost frame of a batch completes."}},"kind":"user","methods":{"EMISSION_TOKEN()":{"notice":"Token delivered to recipients by a gauge-emissions claim on this chain: the `ReceiptToken` on leaf         deployments, or the canonical `TOKEN` on root, where the receipt is redeemed for `TOKEN` in the same         transaction."},"FACTORY_REGISTRY()":{"notice":"Registry used to authenticate pools, target factories, and gauge-to-factory relationships."},"ICA_ROUTER()":{"notice":"Interchain account router used by the cross-chain commands to derive accounts and dispatch commitments."},"IS_ROOT()":{"notice":"Whether this deployment is the root chain, where `VotingEscrow` and the Relay exist."},"LEAF_VOTER()":{"notice":"Leaf Voter used to validate gauge targets and resolve their reward contracts."},"NATIVE_ERC20()":{"notice":"ERC20 entry point of the chain's native asset, on chains where one exists; the zero address elsewhere."},"NATIVE_ERC20_SCALE()":{"notice":"Native value represented by one raw unit of the native ERC20, derived from the token's decimals."},"RELAY_FACTORY_REGISTRY()":{"notice":"RelayFactoryRegistry that `DEPOSIT_RELAY` authenticates a caller-selected relay's factory against; the         zero address on a leaf deployment, where the command is gated off."},"STAKING_ESCROW()":{"notice":"VotingEscrow that `CREATE_STAKE` and `DEPOSIT_RELAY` act on, resolved from the root Voter's         `VOTING_ESCROW()`; the zero address on a leaf deployment."},"STAKING_TOKEN()":{"notice":"Token `CREATE_STAKE` stakes into a new sAERO, resolved from `STAKING_ESCROW.TOKEN()`; zero on a leaf."},"WETH()":{"notice":"Wrapped native token used by wrap and unwrap commands."},"constructor":{"notice":"Initializes the Metarouter."},"execute(bytes,bytes[],uint256)":{"notice":"Runs an ordered command batch as one atomic call."},"msgSender()":{"notice":"Returns the account whose positions and approvals commands act for."},"uniswapV3SwapCallback(int256,int256,bytes)":{"notice":"Pays the input token owed to the currently authenticated CL pool."}},"notice":"Permissionless router for executing composable command batches with temporary asset custody,         returning remaining batch ERC20 and native balances to the original caller when execution ends. Positions         are not returned: one brought into custody must be sent onward by a later command, or closure reverts.","version":1}},"settings":{"compilationTarget":{"V3/src/metarouter/Metarouter.sol":"Metarouter"},"evmVersion":"prague","libraries":{"V3/src/metarouter/Metarouter.sol:ClPositionLib":"0x96fa373a6d7930d67accf441529ccf3477405493","V3/src/metarouter/Metarouter.sol:ClaimsLib":"0x8eda4655fd8e6bb3aff3d3f36610b1efec24aa22","V3/src/metarouter/Metarouter.sol:CrosschainLib":"0x47a3b182d028d503a6e6cd2bd1b4c11960d12113","V3/src/metarouter/Metarouter.sol:LiquidityLib":"0x0028a78d20d2d5d230cc4b2a23b90793a95cb691","V3/src/metarouter/Metarouter.sol:PaymentsLib":"0xa37042e33c31e41b74bf18f0c1b27000f10e9e13","V3/src/metarouter/Metarouter.sol:StakeRelayLib":"0xff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e","V3/src/metarouter/Metarouter.sol:StakingLib":"0xe463e88df582c0b7a6d530f85c2c6954fb4f3c00"},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":10000},"remappings":[":@hyperlane/contracts/=node_modules/@hyperlane-xyz/core/contracts/",":@nomad-xyz/src/=node_modules/@nomad-xyz/excessively-safe-call/src/",":@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/",":@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",":@openzeppelin4/contracts/=node_modules/@openzeppelin/contracts-v4/",":@solady/=node_modules/solady/src/",":V3-script/=V3/script/",":V3-test/=V3/test/",":V3/=V3/src/",":forge-std/=node_modules/forge-std/src/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable-v4/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/"]},"sources":{"V3/src/interfaces/access/IGuardedAccessControlEnumerable.sol":{"keccak256":"0x14ecc1e460091086f667201c43778f638863f618369f358f77bc214dfeeac249","license":"MIT","urls":["bzz-raw://a8c960bc07240dd61bb82640771c9ef6c5c281886a271d600060d0ccde7333a7","dweb:/ipfs/Qmeb5QKdWoWP6WHAihFQvjvEZ4PygUgwEXu8Wou2NhNWn7"]},"V3/src/interfaces/bridge/ILeafMessageOrchestrator.sol":{"keccak256":"0xb8e9f856b05bc5b4d09bce76e123544e2e53f670c86c1ca55fad299c6240caf3","license":"MIT","urls":["bzz-raw://cf1af819cbdd66f47d8d8ae3317631f57e770c1b274aa696de05ca80f4461b58","dweb:/ipfs/QmacgjxRnXrJqcHkAKMjSDzaU8iYaEgxiR6HpDfK64sBQC"]},"V3/src/interfaces/bridge/IMessageAdapter.sol":{"keccak256":"0x7b18fe25644d4afdc7cd1e9c1f6b626c35bcdd885093a3e77876fd76534004bb","license":"MIT","urls":["bzz-raw://12ac646d2458ef421293ea281b890e0b5a8d7939c9be1a24b763bd71b1cd77a2","dweb:/ipfs/QmVX1hX6Hgsg56asv2Xfafw5wQrie8NGR6ytu4JgkCBrPp"]},"V3/src/interfaces/bridge/IMessageOrchestrator.sol":{"keccak256":"0xee174345ab2b659eaec9b9b58a63289b248a5d08dabc7e45945117163d6593b8","license":"MIT","urls":["bzz-raw://40948f9ebd91c5babeab2d5858dbd567c0dab7e7fecd02b5df755744914fe81f","dweb:/ipfs/QmbK8qec3VGL9KARzUCvrXpNKJn1cuUGotgEpZDfaSFfYB"]},"V3/src/interfaces/bridge/IRootMessageOrchestrator.sol":{"keccak256":"0xbda5bc33f7f230e69adf34f25202dcb1b482c7c249709d6b126b2306a718150d","license":"MIT","urls":["bzz-raw://48095b4fe71d91d1fb17c95007718377b8d805be76c5f3ad17aeb1e0ae06b7b7","dweb:/ipfs/QmbcDbNvD4r9dJyRdWm3G9YnxkBnpgNMhKprkSbV8gLvRG"]},"V3/src/interfaces/core/IVotes.sol":{"keccak256":"0x8bf8cfa56e792f61a897186caf85406c436d89e6820f91efdc7422bf682490bb","license":"MIT","urls":["bzz-raw://5b8754dc21b9072f2fabc1be004c0432cd53b041e7ef94314991485e148a9ec5","dweb:/ipfs/QmRHxAjrzHbYzsPRQvaKgVAhxGuMrKcwUbezu8Yb8W4JxC"]},"V3/src/interfaces/core/IVotingEscrow.sol":{"keccak256":"0x3c4b0789b2aed973e2f5f1a35c29a4d2f846fa3ae59ddd1c4d70f0fc620f2351","license":"MIT","urls":["bzz-raw://9c3f11f1020cc7b3350e71224f5c1dab0c49d99f83edbd20645184063cef15fc","dweb:/ipfs/QmR65SEqcNif9Aci9tc7mRswARw8ZSyUpzxAUnTjNsocse"]},"V3/src/interfaces/external/ICrossCollateralTokenRouter.sol":{"keccak256":"0x584940cb41958090219fbf6935cfea079169ad924e8e4c6787119b730c8eb205","license":"MIT","urls":["bzz-raw://7f38915d327f8b058472d9ab030fe9efb32e679b2f1daa17fdc81f1a6ae757f3","dweb:/ipfs/QmeXyGjebF6B9BjiBduJBJPrLmcYKczWXdbWrX4Gdg9TYY"]},"V3/src/interfaces/external/IInterchainAccountRouter.sol":{"keccak256":"0x706eb05a43366e551119fd50a9a10613def52d86897e9764f21dfaf0f6a4a587","license":"Apache-2.0","urls":["bzz-raw://e1466964436558879f05085916f7575a181f3931ffa4d7fccdabb58218d8b78d","dweb:/ipfs/QmYkST5H9Dg5a16eAvDGcKevvPKfbptEY6WuoAhSqdU7jR"]},"V3/src/interfaces/external/INonfungiblePositionManager.sol":{"keccak256":"0x112c1a16a5604f7de6968b66381a8e6c419f59bb695871000d6bd91d6d86ed87","license":"MIT","urls":["bzz-raw://e729f0b0a55affe9da10afdc48414f5ee7e7c7ff5e173f0bf944c485662ed370","dweb:/ipfs/QmY8qWD83Q72YgGKhVkWubbpiGKU3LzVxbWGuc3J98JLAE"]},"V3/src/interfaces/external/ITokenRouter.sol":{"keccak256":"0x13afa0065103f06d907581d3a5e660563d5499ef8265e99247084df5b0152759","license":"MIT","urls":["bzz-raw://d3e58adb2e9255069d9c41199407805a9d926494e169d1c6fd24ec9cdab3631d","dweb:/ipfs/QmXn6HDtCQzvzNK8hk7CeMY3tkZ837qZSr7TdwRFxsgKxx"]},"V3/src/interfaces/external/IWETH.sol":{"keccak256":"0xa391fc9613b32e816c8f767cc82ab694984f1bf0ea9f61dcf5cdf87395945845","license":"MIT","urls":["bzz-raw://7c81a4546c01d55e2dd18f38d7fc6e44f668e1dd7f3e9375edcab9f962819789","dweb:/ipfs/QmQuEvdnrCa6cEXnBeVbeycN34FASosGfvKNoYDbFwBjv2"]},"V3/src/interfaces/factories/ICLFactory.sol":{"keccak256":"0xef86a35f2495a2af31df4eac61628ca880419ff3d4ca269ae49e2ee36bc3c3a8","license":"MIT","urls":["bzz-raw://ddcb537776ac23ecdf4f34fc56d693100e61743124a2617c9901d8f5f10c15c0","dweb:/ipfs/QmZtWHAnbanbEVGVr5ZrTRyhQGbGoWaGsZFM63CMBKoEep"]},"V3/src/interfaces/factories/ICLGaugeFactory.sol":{"keccak256":"0xc44daf33651bd4f6f3ff5b403fbcd11961b34aaf31aa6ad3dde196d33957fa4a","license":"MIT","urls":["bzz-raw://920ba5d94cffc6e6b5ce9fc70852e75bfec6f3a6514cddeee2bd2992c315f6fa","dweb:/ipfs/QmSAraAFBeWnTTJbBdJZ46nWovHmRLASTWV1S3vQk5DmMN"]},"V3/src/interfaces/factories/IFactoryRegistry.sol":{"keccak256":"0xd0c221a5de0a966418f408c333a17d63101d192e02df5d45cac26e0fb7b216ee","license":"MIT","urls":["bzz-raw://e66a8c6761229ffcb572b73758e5facb06ea88f3d2d45c6096d32977ce8fce25","dweb:/ipfs/QmWfhTxnbU3t3xoDh1ZoPM1mj73x8aDZK7v6wNzSSQBhoA"]},"V3/src/interfaces/factories/IGaugeFactory.sol":{"keccak256":"0x91f64efc63b035fc6223573555877c96a060c6646288340e9bdae0b03b464fb5","license":"MIT","urls":["bzz-raw://eedbe72aa265105c92b22841794e3279afb46ec62f40f56a3746809da82844ad","dweb:/ipfs/QmQX3AbFRmVwchNofKMZPMnZwRyeDC9sS6MnBnrT22oPjj"]},"V3/src/interfaces/factories/IPoolFactory.sol":{"keccak256":"0x1f8dc8eab9ed8c2af9fdc70a79ad87fa32c0b944ad264dbfa0ff73840b1eb5cd","license":"MIT","urls":["bzz-raw://210e03abf15c2b019338710a28df9b19da6f34a50e3274a7a3f21d0004d803d5","dweb:/ipfs/QmYcX93yesan7C2BneWPCdqLJV5nqroCrmPRosCgAsmPSZ"]},"V3/src/interfaces/gauges/ICLGauge.sol":{"keccak256":"0xea26076fff11e0af1fbfd6dc48c3be464b96ba5643dabb310d904720a61cadd2","license":"MIT","urls":["bzz-raw://dec10a45101bd2cd0605bd54d1600465244092dcb47ff071419477ca3c5e3b52","dweb:/ipfs/QmX86b9cy1RuvG7ryDfvNfen1CtFgTEemRDJpxk3ndDw93"]},"V3/src/interfaces/gauges/IGauge.sol":{"keccak256":"0x53d8baab3c9b895e7b4033306227dd1a2b676b5cb64fdc07ba15706f8af3902a","license":"MIT","urls":["bzz-raw://34db526d9dc2609595338b3bbc492eb62ad71afcbf02030047e4822603e83abc","dweb:/ipfs/QmX3UNyjjd92a69J7TBUDPTMJbT4AGhTvLA7Yb4QrwhbiH"]},"V3/src/interfaces/gauges/IV2Gauge.sol":{"keccak256":"0xfb6b6b5ffd799fe676cadf2c22b7bce5ee69370f5b86fad4171177fb89dad1bc","license":"MIT","urls":["bzz-raw://eb11ad856e1b45871626ae07ba250488e075fb1d839570036a54c7c12a2bb630","dweb:/ipfs/QmdCt3mJazEm2RRhML2VQNeiRmzN29CYFYQi28gHNYE5nU"]},"V3/src/interfaces/governor/IGovernor.sol":{"keccak256":"0x36e1ca178532510df3fe47b11b9d59bcfdf7a605e514feb46afc4aacb1847e0b","license":"MIT","urls":["bzz-raw://cfa593ed74ec9cbc127bc3fbd8dd5961a43048750d4f2359fb96078b97054d1e","dweb:/ipfs/QmZCu2HfqRgjhYoQzww3MQCcXoZ4XdB4dDg5XJpLKGzPwD"]},"V3/src/interfaces/metarouter/IMetarouter.sol":{"keccak256":"0x72504377ca4b8c8d61abe9213388e5f68f1033723360aa4694b0c55cb93f0c18","license":"MIT","urls":["bzz-raw://2385baa0fe257b37cb9857e338d4f369efe453fdd18ac545c1df9d472978014f","dweb:/ipfs/QmPXXdiXegAmgWmtbbuTzFHJ9RntQqTjkcHBX2NR6GPeUL"]},"V3/src/interfaces/minter/IMinter.sol":{"keccak256":"0x913f2666af380066174d26816f720a661f244fef6d251418634c2cbf61559daa","license":"MIT","urls":["bzz-raw://8a5e413002cf908df15f334e4cd354a3995bf579682ee1df39d86d28707fe8ea","dweb:/ipfs/QmVy9SysvtfnYaZK3vwHjCyKhvKBJtLop7MfFBtrbTnrho"]},"V3/src/interfaces/pools/ICLPool.sol":{"keccak256":"0xf2475f01b92b8f774e617c876aa90afd199c5735177bae2731b3cde2fb4d42d9","license":"MIT","urls":["bzz-raw://afe042761795abe8aeaa60ba8db7b5bcdaf7331f2c77904af1200fac4e309669","dweb:/ipfs/QmVrvjPPfNCBVtn6xADPoFMoxxXY4qNvw27dfBgneruTfm"]},"V3/src/interfaces/pools/IPool.sol":{"keccak256":"0x4ac3d8b3381f9f0b24516a34f28a25c36a3f11448b72e11155a8fb47e33cf65c","license":"MIT","urls":["bzz-raw://5e5fd853c52b861cb4884edfdef7519cdac15a852a59f0047ec8582280fb8a68","dweb:/ipfs/QmbxZcm4BH4Nu4V2rm767AtxHnroZofENMSNQJjg4dknc7"]},"V3/src/interfaces/pools/tape/IPoolTape.sol":{"keccak256":"0xbafec7377a6f67eafa045e7395c59cdbab75e2a517207868cb216c69289d1b36","license":"MIT","urls":["bzz-raw://9bbb4ad7a82504240c578972aa0cb4c5dbcf64a3cd34d455df2878c37061f0a4","dweb:/ipfs/QmPnZJ1JQXdWBo7mStv4Rcw1C51mmBHZp8eSosFyKfa2WU"]},"V3/src/interfaces/relay/IRelay.sol":{"keccak256":"0x126025e3d275c533bd5cfc1f40f2fa8c3878eae0613ab406d46a166f4e397e7a","license":"MIT","urls":["bzz-raw://9bf7c3035c3dbdf12e19ae8e30125bd84a5b064c86652186b7603ca0f24402b4","dweb:/ipfs/QmedrJXWn372U4cmQsdey6SJuqgFWYaAQKt7CoUo8VC47p"]},"V3/src/interfaces/relay/IRelayFactory.sol":{"keccak256":"0x76c9eb0e37cd2c50e6d97b6e992404405b6367d48b1c320faf1ff2724559ae99","license":"MIT","urls":["bzz-raw://d1867dae28c7ff0ae0887663d98d88a72662bd300ae3f4bd0da5fe6d08f8a9d1","dweb:/ipfs/QmcNMrey5LFZ1TJf6rm1mdSTtXq77UqtVcU5oUviwntU46"]},"V3/src/interfaces/relay/IRelayFactoryRegistry.sol":{"keccak256":"0xbac5a96f853734ebc44fc97b3fa8c0fb8daff7830abff0526236be93f1eed135","license":"MIT","urls":["bzz-raw://437102bad49823b00b06518348fa85e305a7243d016f9d9009210485775e9a18","dweb:/ipfs/QmXTPCXFZjFqzhAvAvdMRC2DGmyKALTCZE9Bp9bCjS7Gcb"]},"V3/src/interfaces/relay/IRelayState.sol":{"keccak256":"0x60768a03fa28a0eb43c20432332fe83f69f08592d9c18878118d2ee9fa21e08d","license":"MIT","urls":["bzz-raw://6b6488e2abe031d427cf419436b7ca00f5feaa46f0b4e0ce28b7215731d15a49","dweb:/ipfs/QmY4PMmetrAayPSbco1qpfMXpq5NsMCwph94RCedwY8h2j"]},"V3/src/interfaces/relay/IRelayToken.sol":{"keccak256":"0x941cb0863a92aa4bca38f455e7b10f1411638e16f6b692afa09c374f3569b0f1","license":"MIT","urls":["bzz-raw://97f993927244ea0433b74eebcded0f417893048c1a93a7552dc2499b3a22d5d6","dweb:/ipfs/QmUHoHfftdL7aFfWdjYoAmxj6BqQt3iSrHvEXNv6c4Qo3n"]},"V3/src/interfaces/relay/IRelayVoteAdapter.sol":{"keccak256":"0xad39e2987b04b1ac3ddcfcbd05d01803080c3b39689e4fd8dffc1b773b4c292a","license":"MIT","urls":["bzz-raw://5902474e4141bfd925be3b0acfbe7468c8f2ebe2ab6e84f825388fbe253f3577","dweb:/ipfs/QmRNFshP3GUCmb2w5q33ihnxSqHdwaktDhPsLPk1XzFVjP"]},"V3/src/interfaces/token/IBaseTokenExtensions.sol":{"keccak256":"0x1193e87fd0e41a37a76438271901fd43b6c56cbf0e9a4999ee0fa123d514dae3","license":"MIT","urls":["bzz-raw://58103c2acbcbbce7d031d1b492daf3b9db25d72933767011bdb128ce40973f25","dweb:/ipfs/QmdHneSTfyJX6PRi6Lia8qdzyLN8G7W5R8C2eKTURpsabs"]},"V3/src/interfaces/token/IReceiptTokenExtensions.sol":{"keccak256":"0xb2275cc40f1ccd0ebecb504d1efe0162341cfae4db8d938bc81441a63a7b917a","license":"MIT","urls":["bzz-raw://6c57dbcd8a9445ea273c6b16d25da50ad53ad80011a0247e7a1549d885962bb9","dweb:/ipfs/QmRkuv9fnRNpHT5rJqzkfA1j6g5KU2VXfb2jVrWb4pgkKn"]},"V3/src/interfaces/token/IToken.sol":{"keccak256":"0x75669171b54302272b0168c3a10e11e58f62771dba71bcd6835bfa512da125b5","license":"MIT","urls":["bzz-raw://9813286031581eabebd81fce3bf8443bc0e4b3a55f6af2bc6a77b78afab37252","dweb:/ipfs/QmeWJBxAMQLWGH1iX17ybAqFjqM9RQx7CVt4X1hBSfPBj5"]},"V3/src/interfaces/token/ITokenExtensions.sol":{"keccak256":"0x49e7226f0a214bb6e9b295fc6220aa154f711ca52d5e1d388278bd91c5d301f4","license":"MIT","urls":["bzz-raw://c13b7c5865e186b6208cf666bb9a439f5d77dd17a472d34b483b3f9cddf30686","dweb:/ipfs/Qmc7EBEEhPxNpXLHEnqt9u43V6CMTXkQaY8RLQKYNe7h86"]},"V3/src/interfaces/voter/ILeafVoter.sol":{"keccak256":"0xe9322fa1c635cc98d8c5d2ea5b2bd870f791d740cdf9f389e1aebe1fe62f2795","license":"MIT","urls":["bzz-raw://35da24d74cf2bb922f9f2a0adfe8b4aba7bc5e0fa4922cfb9b9e1ca0dd3899cc","dweb:/ipfs/QmbffNRzXr2qhMZHddeoRTVV1Hms5r31vvQjqMdsgAs9iJ"]},"V3/src/interfaces/voter/IVoter.sol":{"keccak256":"0xea47f4fa7b941883cc8de93f5c80a3d26535565f9edee4e96ea6d4d330a4ca0e","license":"MIT","urls":["bzz-raw://37b3ac60118f9403de3acc1af8fca7b687298df153a41e6a40c23deddb1382b5","dweb:/ipfs/QmZAy48GcJbpNSBbLTo4XbzZC1hfwTHWb2aXscHT9UTaja"]},"V3/src/interfaces/voter/IVoterCommon.sol":{"keccak256":"0x4d94a455b9073150710fbf6192fe407ceb1f50ab0bd2e325092adeb74684b060","license":"MIT","urls":["bzz-raw://2ad4d1a2149d0a64ffad7f71da0495f32c2a76ccd3486215d412d6cca61ad0d7","dweb:/ipfs/Qmd11qzHeSC4tFM16UpWrb85y9Ap4BHTfmgPNMzTtoqeuF"]},"V3/src/interfaces/vpm/IVoterPaymentsModule.sol":{"keccak256":"0xe2f96d023fe49ca702b0faa75cf06910953de06557b4db36689722b95395189f","license":"MIT","urls":["bzz-raw://49ec5cfc18b0dadefb822ff4866e90d8a54e4bbd3b416b1df9f88a9f7e5088e3","dweb:/ipfs/QmTy9UGkPqqzCD2T7UJgHMHgYa9PbDqodGZsmjt6GwgeL4"]},"V3/src/libraries/ProtocolConstants.sol":{"keccak256":"0xa35de7c22660ced91973c97d762d3ad1554f2f2344695a5676a67c8d5cb9f0d0","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://251ee6fc146b6dc763d98525146023e6f579d38349f28cf5d28f4274d91b7423","dweb:/ipfs/QmdtGxudVWw9oKQGcW1tdXhtPcEs4RDKsRp2eoqH3wcxYf"]},"V3/src/metarouter/Metarouter.sol":{"keccak256":"0x493af0f9a9c21ce9fb7e4c91fb938323c4ba6fd4a427d656d24b5e707aceae42","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://9f026a8ab7836456fa8b1ae73d99f7dd28e370714944f556b05267ab6f63548a","dweb:/ipfs/QmfGyvj4UBGYafxUAEpytzPQxAyrFfB92paTHyK5gbKfZh"]},"V3/src/metarouter/TransientTracking.sol":{"keccak256":"0x4e796609c7f041ab518c0f6541858b4b486a8e709674ea4b403121f980f3c510","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://e5dab1841353095ad2f7b3ccd200ba236718cda79d8fe7e7e90de6a25467b3a7","dweb:/ipfs/QmXEi6XdenhxPsgf8Jb5yACPEbxZM8sQUkKiufeu472XoY"]},"V3/src/metarouter/libraries/ClPositionLib.sol":{"keccak256":"0xb35588df2eb9056ad4268e76bbd17234635d241b505c87377af1386c228514c0","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://d05735834dcd47accb67ec2f48292c154cab54342521896ca6d2b08f8a7389ae","dweb:/ipfs/QmYHGE44bjtAVCKxiZL7sypuRERMsEWPU4caUpcVRhTBu6"]},"V3/src/metarouter/libraries/ClResolverLib.sol":{"keccak256":"0x766016b125e3f1cb4401ca293c1186656cce38e85904f24dffc43a1f8a127f56","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://0e9f33d5a30b3f19b67bd65c0af277437b9f0d532cd96507c5606f76624b96b7","dweb:/ipfs/QmZpwbskkve4krGcAqcckfphEV2Maje7qQfmDYz9gvYiYt"]},"V3/src/metarouter/libraries/ClaimsLib.sol":{"keccak256":"0xcb9098efd94cc6d1a2153588bc634ea7a7e018f90fb376bd9344e7247765802d","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://54bc9881cd5a7264babb3899377c3f9c5a4a7c03653247cd34c1acaead8568d4","dweb:/ipfs/QmQbGTqWHkmnqmjMHdM6bBJzL8hu6A3nbEfbHbe3Jg4Lrg"]},"V3/src/metarouter/libraries/Commands.sol":{"keccak256":"0xadd0e4f6e51dc287566403f2ac7040979188c9b34a14c63b7cbf0df43e62dcd9","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://ea804e72c5a1dcdaa384174e5633168e8d3831da25c57be466fb39e483f7106d","dweb:/ipfs/QmQXLSAyqT99DNrMGFVEFBvqmVD1kfXvYSCCdSs2bFQyZ8"]},"V3/src/metarouter/libraries/CrosschainLib.sol":{"keccak256":"0x8d9ad964ab00abdfe3ac3acade779920d8b2bc99062a85517ed83eb46050beba","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://b62dc81e52ba0abbdf168c4db879ab5e9cf7931ae735226029a513e2cfe916cb","dweb:/ipfs/Qmeko1Dgr9t5t5jNhveG2VVuMLgnj92ThQG9jtgRsa465p"]},"V3/src/metarouter/libraries/FundsLib.sol":{"keccak256":"0x6a5aa9fa4e88781ff6c68dd2a239592790b20c3d7efe7ae64a11c6b5902f2070","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://fd8bc01f6a06ea524202c9f4eece3a2667caefed6b211ce4c7a6b081214f27aa","dweb:/ipfs/QmV37DFmFE7h1ox1nqAe5vXAbnNJF7HQ5GJ3QTKAgwZJek"]},"V3/src/metarouter/libraries/GaugeLib.sol":{"keccak256":"0xd15905b084b932b4aa09e8aa4661c9d124d5225914a2f96a574ac23153aabfa9","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://99defc2c16b2374ed917adafe16e5b483889be78a8387a73c6d4655527d74c17","dweb:/ipfs/QmTYyN2mxvsjbUEgAdUnxAhWSUvGaTK1nPKr4yrQodREAV"]},"V3/src/metarouter/libraries/LiquidityLib.sol":{"keccak256":"0x1fcbc834191c1e0ec3727b97d66ce3a8a08f51653e859d2d302b5466c0d74e78","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://7776e1ade2e70844c2f506d40a5a9f585a05ffe660a12d359cbe31866940eae9","dweb:/ipfs/QmR3Q33WXcSppB7nZqoNVLcBiPuGapqjwxXNbMGf2q8Myw"]},"V3/src/metarouter/libraries/MetarouterState.sol":{"keccak256":"0x66999b95ca988e2fbab9062c82ea0c685f5a8bb27098ca1c0f679097f9a2c670","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://d3a6b3e921ec2c50af1548d7297852d9d57b0e9b37c9eae5f989b12fb634527f","dweb:/ipfs/QmamafPgWQQUnEqdVurgSHNjsxnYPsopCvjwTeLqzHKEiX"]},"V3/src/metarouter/libraries/PaymentsLib.sol":{"keccak256":"0x8573b0cf5923cfddf59bdbaeb0bc8580a021c2f3fcefb759beb6cbd9dbb4f179","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://2495ae89b8c658baa9f778f7686bf6425bd8540c5817bee6fe4b4bec75a962c1","dweb:/ipfs/QmZHhwCB8V5RFhxvD5WM2Tav7dYgjhA2AFijuqrPCRPHzU"]},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"keccak256":"0xe3ab9bcc4f32ed8fcfebb09250d33536286f53957c8879de5dcc56e6a7d79b45","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://4e49a6553f7c0cd127de8837dd01d9944e6dde30bad99554b3687663cb7c9004","dweb:/ipfs/Qmba8RgMbVXjhUakxpqkEoxfUeiXfeSR8vVgvmNnzMSyT4"]},"V3/src/metarouter/libraries/StakingLib.sol":{"keccak256":"0x05f1e479a430d03813fccccc5419576123060934c36c54f929497c9101fe821a","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://3cbce08fee8efb77aea5aefc89beaad1dd05cda0be6530919ad4f158aa502894","dweb:/ipfs/QmXneAd8c6XCTcktii9nhT4VTr3Yhzvfvku9GWDCmJupKz"]},"V3/src/metarouter/libraries/TokenRouterLib.sol":{"keccak256":"0xc28c96ec3998401c718c4165f625c79eb4cdb608fb0333a431b1ee0786c88953","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://57ffdf261789654b0c975cdf4a7482bc82fca21d80254ad58e38b1922cf712bf","dweb:/ipfs/QmTcLZkZDsESdeVtvfyPUBKihPRjyZwmoVxajodfiUXG9W"]},"V3/src/metarouter/libraries/V2PoolLib.sol":{"keccak256":"0x3487a47e82f260a7f21a59d05b9d27455d093ca02f61e1669c44dd8cbc582977","license":"LicenseRef-Dromos-Restricted-Use-1.0","urls":["bzz-raw://2ee8bcb70b2d5e38566290df62d93267a5f8de0097ab3c8fe9863a1d406d989e","dweb:/ipfs/QmVhM2grBkNuFsxbZiTsQHdP6nEB2jDKGzqDMWRnYKMomv"]},"node_modules/@openzeppelin/contracts/access/IAccessControl.sol":{"keccak256":"0xbff9f59c84e5337689161ce7641c0ef8e872d6a7536fbc1f5133f128887aba3c","license":"MIT","urls":["bzz-raw://b308f882e796f7b79c9502deacb0a62983035c6f6f4e962b319ba6a1f4a77d3d","dweb:/ipfs/QmaWCW7ahEQqFjwhSUhV7Ae7WhfNvzSpE7DQ58hvEooqPL"]},"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol":{"keccak256":"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d","license":"MIT","urls":["bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100","dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d"]},"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol":{"keccak256":"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc","license":"MIT","urls":["bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037","dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ"]},"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol":{"keccak256":"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44","license":"MIT","urls":["bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d","dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF"]},"node_modules/@openzeppelin/contracts/interfaces/IERC4906.sol":{"keccak256":"0x856ca1885aec23d54da3f2760b5d216d1b28ad20f798000336375a30dbbc1558","license":"MIT","urls":["bzz-raw://dc725c462ccbf284432d3123ab8c9bab24903730cae227ae4945878039d2fe54","dweb:/ipfs/QmdiEVMvm8njp96dm2s4mThYBD74tY59mNP6s7CzKkGHAh"]},"node_modules/@openzeppelin/contracts/interfaces/IERC6372.sol":{"keccak256":"0xed0f7f14eb30c80a82855ddc3f7267bb6290546e5847a8ffc33f599ce4bc5eb6","license":"MIT","urls":["bzz-raw://63fab00bbb42ce6f132a93d1c1e1cfed5175821521fb8746caa48129787d2435","dweb:/ipfs/QmVMBNhmVW1h35LsaYNyDChfyTwF8M3EW9T1JDFpsXiaQF"]},"node_modules/@openzeppelin/contracts/interfaces/IERC721.sol":{"keccak256":"0xca34c490d41c332106d30b657f00dc028532cb6b9fef2b1729670ce476b36bce","license":"MIT","urls":["bzz-raw://ef5e7685d50ed8aae2104a7eb2c31ae5a3b508f24fadfa7611f92f819201aee9","dweb:/ipfs/QmYbTD32FPrEfP1hkniQmRxVUWp8GTSqFV1Bhwx1HVirse"]},"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol":{"keccak256":"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2","license":"MIT","urls":["bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303","dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV"]},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"keccak256":"0xd6fa4088198f04eef10c5bce8a2f4d60554b7ec4b987f684393c01bf79b94d9f","license":"MIT","urls":["bzz-raw://f95ee0bbd4dd3ac730d066ba3e785ded4565e890dbec2fa7d3b9fe3bad9d0d6e","dweb:/ipfs/QmSLr6bHkPFWT7ntj34jmwfyskpwo97T9jZUrk5sz3sdtR"]},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol":{"keccak256":"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff","license":"MIT","urls":["bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9","dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6"]},"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"keccak256":"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098","license":"MIT","urls":["bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0","dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j"]},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol":{"keccak256":"0xf78f05f3b8c9f75570e85300d7b4600d7f6f6a198449273f31d44c1641adb46f","license":"MIT","urls":["bzz-raw://e28b872613b45e0e801d4995aa4380be2531147bfe2d85c1d6275f1de514fba3","dweb:/ipfs/QmeeFcfShHYaS3BdgVj78nxR28ZaVUwbvr66ud8bT6kzw9"]},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol":{"keccak256":"0x88cd5e3bee2e8c36b8d9058fbcaa81ad5704281b25634122234b55ea853d8055","license":"MIT","urls":["bzz-raw://8dc7e7ab5b8ea36c15027ab04221b05d1c970f47a53e9fd47ead8ca665d49c7e","dweb:/ipfs/Qmeeph7fsDyfRr8vb2L8KcDEmKPb224TAayMvgqgGAnqpL"]},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol":{"keccak256":"0xaa3852717be1903bf8b8a66c7ce323f70ac93227769c450f2b332fdd16bd9198","license":"MIT","urls":["bzz-raw://09ce2e4a5b1064a392594c0d5efeb3ccd8eacf431e55a85574cafb6bfb72ba69","dweb:/ipfs/QmUbT5UomYpwwMrNMzzuNcGb4sxuMZ4jz8mMPZewX8mEPn"]},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol":{"keccak256":"0xf46268c37522320bb2119a5a394bc5c739a95c0c574c8d08e8c643f4d06e5c76","license":"MIT","urls":["bzz-raw://517e4b295f35b9947c72ad7379a6089439ece7bb6f4a2ea0a159da13046c039e","dweb:/ipfs/QmZXzkSfLUbvujig3zVbpDHykpHhqLpvQtdiN3B5j4TA3u"]},"node_modules/@openzeppelin/contracts/utils/Panic.sol":{"keccak256":"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a","license":"MIT","urls":["bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a","dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG"]},"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol":{"keccak256":"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c","license":"MIT","urls":["bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617","dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u"]},"node_modules/@openzeppelin/contracts/utils/math/Math.sol":{"keccak256":"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857","license":"MIT","urls":["bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5","dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y"]},"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol":{"keccak256":"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083","license":"MIT","urls":["bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9","dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif"]}},"version":1},"storageLayout":{"types":null,"storage":[]},"transientStorageLayout":{"types":null,"storage":[]},"userdoc":{"kind":"user","errors":{"Expired()":[{"notice":"Thrown when the batch deadline has passed."}],"ZeroAmount()":[{"notice":"Thrown when a command resolves a zero asset amount to act on."}],"InvalidPath()":[{"notice":"Thrown when a pool path is empty or its adjacent tokens do not connect."}],"ZeroAddress()":[{"notice":"Thrown when a constructor dependency is the zero address."}],"InvalidPayer()":[{"notice":"Thrown when a payer is neither the execution address nor the logical sender."}],"PoolNotFound()":[{"notice":"Thrown when the pair has no pool and the command may not create one."}],"NftNotCleared()":[{"notice":"Thrown when a tracked NFT still belongs to the router at batch closure."}],"NoInFlightNft()":[{"notice":"Thrown when a command references the in-flight NFT but none of the expected collection is in flight."}],"AmountOverflow()":[{"notice":"Thrown when an amount cannot be represented as a signed CL swap amount."}],"BatchNotActive()":[{"notice":"Thrown when an inbound asset reaches the router outside a batch."}],"ContractLocked()":[{"notice":"Thrown when an external caller enters `execute()` while a batch is running."}],"LengthMismatch()":[{"notice":"Thrown when the commands and inputs arrays differ in length."}],"NftNotReceived()":[{"notice":"Thrown when a gauge withdrawal returns without delivering the requested position through the receiver."}],"NotLeaf(uint256)":[{"notice":"Thrown when a leaf-only command (redeem) runs on the root deployment."}],"NotRoot(uint256)":[{"notice":"Thrown when a root-only command (sAERO creation or relay deposit) runs on a leaf deployment."}],"NftNotInCustody()":[{"notice":"Thrown when a command would operate a router-held NFT that did not enter custody during the active batch."}],"InvalidAmountOut()":[{"notice":"Thrown when an exact-output swap delivers a different output than the requested amount."}],"InvalidEthSender()":[{"notice":"Thrown when ETH arrives from an unexpected sender outside a batch."}],"InvalidGaugeType()":[{"notice":"Thrown when position ids are supplied for a gauge that does not support position-level claims."}],"InvalidNftSender()":[{"notice":"Thrown when an NFT arrives from a collection other than the one the active command solicited."}],"InvalidRecipient()":[{"notice":"Thrown when a payment command names an invalid recipient."}],"InvalidSpendMode()":[{"notice":"Thrown when an external pull uses a router-balance spend mode."}],"NotPositionOwner()":[{"notice":"Thrown when a CL position command targets a position the logical sender does not own."}],"TooMuchRequested()":[{"notice":"Thrown when a swap requires more input than the command authorized."}],"InvalidSwapDeltas()":[{"notice":"Thrown when a CL swap reports a positive output-token delta."}],"PoolNotRegistered()":[{"notice":"Thrown when a V2 liquidity command or fee claim targets a pool without a FactoryRegistry creation record."}],"UnauthorizedRelay()":[{"notice":"Thrown when a relay deposit targets an address whose reported factory the RelayFactoryRegistry does not         approve, or which that factory did not create."}],"WethIsNativeErc20()":[{"notice":"Thrown when the wrapped native token and the native ERC20 are the same address."}],"DirectCallRequired()":[{"notice":"Thrown when Metarouter is reached through delegatecall instead of a direct call."}],"FactoryNotApproved()":[{"notice":"Thrown when an operation requiring current target-factory approval selects an unapproved factory."}],"GaugeNotRegistered()":[{"notice":"Thrown when a claim or stake targets a gauge not registered with the Voter."}],"InFlightNftPresent()":[{"notice":"Thrown when a producer command would leave a second NFT in flight before the first is consumed."}],"InvalidBridgeQuote()":[{"notice":"Thrown when a caller-selected warp route quotes a total charge below the amount being bridged, which no         honest route reports because the charge covers the delivered amount itself."}],"InvalidPips(uint256)":[{"notice":"Thrown when a pip spend exceeds 100%."}],"InvalidPool(address)":[{"notice":"Thrown when a pool has no recorded factory, its recorded factory does not authenticate it or differs         from the supplied factory, or its pool family is unsupported for the command."}],"PenaltyNotAccepted()":[{"notice":"Thrown when a routed V2 gauge claim or withdrawal would incur a penalty without explicit user consent."}],"TokenFeeExceedsMax()":[{"notice":"Thrown when a warp route's token fee exceeds the caller's accepted maximum."}],"UnregisteredDomain()":[{"notice":"Thrown when a cross-chain dispatch targets a domain with no interchain account router enrolled."}],"BridgeTokenMismatch()":[{"notice":"Thrown when the caller-selected warp route does not manage the token being bridged: the route's `token()`         does not equal the command's token, so it would pull or burn a different asset than the router approved.         Guards an honest token/route mismatch; an untrusted route can still misreport, so this is not route trust."}],"InsufficientAmount0()":[{"notice":"Thrown when a liquidity command's resolved token0 amount falls below its minimum."}],"InsufficientAmount1()":[{"notice":"Thrown when a liquidity command's resolved token1 amount falls below its minimum."}],"InsufficientAmountA()":[{"notice":"Thrown when an add-liquidity command's resolved tokenA amount falls below its minimum."}],"InsufficientAmountB()":[{"notice":"Thrown when an add-liquidity command's resolved tokenB amount falls below its minimum."}],"InvalidHookMetadata()":[{"notice":"Thrown when a cross-chain dispatch's hook metadata carries no refund address."}],"NftSenderNotCleared()":[{"notice":"Thrown when a command would arm an expected NFT sender while another authorization is still pending."}],"UnexpectedNftSender()":[{"notice":"Thrown when a position arrives from a sender the active command did not solicit it from."}],"UnauthorizedRelayVpm()":[{"notice":"Thrown when a relay reports a VoterPaymentsModule the staking escrow does not recognize (it lacks         `VPM_ROLE`), so the router refuses to grant it the operator approval a deposit needs."}],"InvalidCallbackDeltas()":[{"notice":"Thrown when a callback does not contain exactly one positive token delta."}],"TokenFeeExceedsAmount()":[{"notice":"Thrown when a warp route's token fee equals or exceeds the amount being bridged, leaving nothing to         deliver."}],"CommandDisabled(uint256)":[{"notice":"Thrown when a command depends on a protocol contract this deployment was built without."}],"InvalidReserves(address)":[{"notice":"Thrown when a V2 pool's token balance is below its recorded input reserve."}],"NativeBalanceNotCleared()":[{"notice":"Thrown when the router's native balance differs from its pre-batch balance after the closing refund."}],"PoolTokenMismatch(address)":[{"notice":"Thrown when the factory resolves a pool that does not hold the requested token pair."}],"CallbackNotCleared(address)":[{"notice":"Thrown when a CL pool returns without consuming its callback authorization."}],"InvalidCommandType(uint256)":[{"notice":"Thrown when a command byte decodes to an undefined command ID."}],"NativeTransferFailed(bytes)":[{"notice":"Thrown when a native ETH transfer fails, bubbling the callee's revert data."}],"InsufficientBalance(address)":[{"notice":"Thrown when the execution-address balance cannot cover a spend or minimum floor."}],"InvalidNativeErc20Decimals()":[{"notice":"Thrown when the native ERC20 reports more decimals than the native asset's eighteen."}],"PreBatchNativeBalanceSpent()":[{"notice":"Thrown when a batch spends native ETH held before that batch started."}],"InvalidCallbackCaller(address)":[{"notice":"Thrown when a caller is not the currently authorized CL pool."}],"InvalidInterchainAccountConfig()":[{"notice":"Thrown when an interchain account configuration names an ISM without a custom destination router."}],"UnsupportedCrossCollateralToken()":[{"notice":"Thrown when explicit cross-collateral routing is requested with the zero-address native-token marker."}],"TooLittleReceived(uint256,uint256)":[{"notice":"Thrown when an exact-input swap receives less than its minimum."}],"UnsupportedBridgeFeeToken(address)":[{"notice":"Thrown when a bridge quote includes a nonzero fee in a token other than the source token or native         currency."}],"SameDomainCrossCollateralTransfer()":[{"notice":"Thrown when explicit cross-collateral routing targets the origin domain's synchronous transfer path."}],"PositionManagerNotConfigured(address)":[{"notice":"Thrown when no record names a factory's position manager: the factory getter returns the zero address,         or it reverts and the registry pairs the factory with no gauge factory, or the paired gauge factory         binds the zero address."}],"BridgeQuoteExceedsBudget(uint256,uint256)":[{"notice":"Thrown when a native warp route quotes the reduced bridge amount above the resolved budget."}],"InsufficientLiquidityMinted(uint256,uint256)":[{"notice":"Thrown when an add-liquidity command mints fewer LP tokens than requested."}],"GaugeFactoryMismatch(address,address,address)":[{"notice":"Thrown when a gauge reports a factory other than the one permanently recorded for it."}],"PositionManagerFactoryMismatch(address,address)":[{"notice":"Thrown when the position manager a factory names does not point back at that factory."}]},"events":{"BatchExecuted(address)":{"notice":"Emitted when the outermost frame of a batch completes."}},"notice":"Permissionless router for executing composable command batches with temporary asset custody,         returning remaining batch ERC20 and native balances to the original caller when execution ends. Positions         are not returned: one brought into custody must be sent onward by a later command, or closure reverts.","methods":{"WETH()":{"notice":"Wrapped native token used by wrap and unwrap commands."},"IS_ROOT()":{"notice":"Whether this deployment is the root chain, where `VotingEscrow` and the Relay exist."},"constructor":{"notice":"Initializes the Metarouter."},"msgSender()":{"notice":"Returns the account whose positions and approvals commands act for."},"ICA_ROUTER()":{"notice":"Interchain account router used by the cross-chain commands to derive accounts and dispatch commitments."},"LEAF_VOTER()":{"notice":"Leaf Voter used to validate gauge targets and resolve their reward contracts."},"NATIVE_ERC20()":{"notice":"ERC20 entry point of the chain's native asset, on chains where one exists; the zero address elsewhere."},"STAKING_TOKEN()":{"notice":"Token `CREATE_STAKE` stakes into a new sAERO, resolved from `STAKING_ESCROW.TOKEN()`; zero on a leaf."},"EMISSION_TOKEN()":{"notice":"Token delivered to recipients by a gauge-emissions claim on this chain: the `ReceiptToken` on leaf         deployments, or the canonical `TOKEN` on root, where the receipt is redeemed for `TOKEN` in the same         transaction."},"STAKING_ESCROW()":{"notice":"VotingEscrow that `CREATE_STAKE` and `DEPOSIT_RELAY` act on, resolved from the root Voter's         `VOTING_ESCROW()`; the zero address on a leaf deployment."},"FACTORY_REGISTRY()":{"notice":"Registry used to authenticate pools, target factories, and gauge-to-factory relationships."},"NATIVE_ERC20_SCALE()":{"notice":"Native value represented by one raw unit of the native ERC20, derived from the token's decimals."},"RELAY_FACTORY_REGISTRY()":{"notice":"RelayFactoryRegistry that `DEPOSIT_RELAY` authenticates a caller-selected relay's factory against; the         zero address on a leaf deployment, where the command is gated off."},"execute(bytes,bytes[],uint256)":{"notice":"Runs an ordered command batch as one atomic call."},"uniswapV3SwapCallback(int256,int256,bytes)":{"notice":"Pays the input token owed to the currently authenticated CL pool."}},"version":1},"devdoc":{"kind":"dev","title":"Metarouter","errors":{"NotLeaf(uint256)":[{"params":{"_commandType":"Command ID that is leaf-only."}}],"NotRoot(uint256)":[{"params":{"_commandType":"Command ID that is root-only."}}],"InvalidPips(uint256)":[{"params":{"_pips":"Pip value that exceeded the 100% denominator."}}],"InvalidPool(address)":[{"params":{"_pool":"Invalid pool address."}}],"CommandDisabled(uint256)":[{"params":{"_commandType":"Command ID that is disabled on this deployment."}}],"InvalidReserves(address)":[{"params":{"_pool":"Pool with invalid reserves."}}],"PoolTokenMismatch(address)":[{"params":{"_pool":"Resolved pool address."}}],"CallbackNotCleared(address)":[{"params":{"_pool":"Pool still stored as the expected callback caller."}}],"InvalidCommandType(uint256)":[{"params":{"_commandType":"Undefined command ID that was dispatched."}}],"NativeTransferFailed(bytes)":[{"params":{"_data":"Revert data returned by the failed low-level call."}}],"InsufficientBalance(address)":[{"params":{"_asset":"ERC20 address, or address(0) for native ETH."}}],"InvalidCallbackCaller(address)":[{"params":{"_caller":"Unauthorized callback caller."}}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC-20 token failed."}],"TooLittleReceived(uint256,uint256)":[{"params":{"_minimum":"Minimum output requested.","_received":"Actual output received."}}],"UnsupportedBridgeFeeToken(address)":[{"params":{"_token":"Address of the unsupported fee token."}}],"PositionManagerNotConfigured(address)":[{"params":{"_factory":"Factory whose position manager is unset."}}],"BridgeQuoteExceedsBudget(uint256,uint256)":[{"params":{"_quote":"Native total the route quotes for the reduced bridge amount.","_budget":"Native budget resolved for the bridge."}}],"InsufficientLiquidityMinted(uint256,uint256)":[{"params":{"_minted":"LP tokens minted by the pool.","_minimum":"Minimum LP tokens requested by the caller."}}],"GaugeFactoryMismatch(address,address,address)":[{"params":{"_gauge":"Gauge whose factory identity is inconsistent.","_recordedFactory":"Gauge factory recorded by the FactoryRegistry.","_reportedFactory":"Gauge factory reported by the gauge itself."}}],"PositionManagerFactoryMismatch(address,address)":[{"params":{"_factory":"Factory that named the manager.","_positionManager":"Position manager that failed the reverse-link check."}}]},"events":{"BatchExecuted(address)":{"params":{"_sender":"Logical sender that owned the completed batch."}}},"details":"Virtual functions allow future variants to inherit from this contract and override selected behavior.","methods":{"constructor":{"params":{"_weth":"Wrapped native token used by payment commands. Zero on a chain with no wrapped-native token, where        `WRAP_ETH` and `UNWRAP_WETH` revert with `CommandDisabled`. Never the native ERC20.","_icaRouter":"Interchain account router used by the cross-chain commands. Zero on a lite deployment with no        cross-chain layer, where every command that derives an interchain account is disabled.","_leafVoter":"Leaf Voter used to validate gauge targets and, on leaf, to resolve the emission `ReceiptToken`.        Zero on a lite deployment with no voting system, where the gauge staking and claim commands are disabled.","_rootVoter":"Root Voter used only on root to resolve the emission token and the staking escrow; unused on leaf.","_nativeErc20":"ERC20 entry point of the chain's native asset, whose spend resolution and closing sweep are        capped so they cannot drain the pre-batch native balance. Zero on a chain whose native asset has no ERC20        entry point. A nonzero native ERC20 must report its decimals: the native-to-token scale is derived from        them, so a native ERC20 expressing the native asset in fewer decimals than native's eighteen converts correctly.","_factoryRegistry":"Registry used to authenticate recorded pools and CL factories, require factory approval        for pool creation, and resolve permanent factory relationships backing position managers.","_relayFactoryRegistry":"RelayFactoryRegistry used only on root to authenticate `DEPOSIT_RELAY` relays through        their factory; unused on leaf."},"details":"The emission token and the staking escrow are derived from the protocol, not passed. On root (this chain      equals the leaf voter's orchestrator `ROOT_CHAIN_ID`) the emission token is the root Voter's `MINTER().TOKEN()`      and the staking escrow is the root Voter's `VOTING_ESCROW()`, the canonical escrow `CREATE_STAKE` and      `DEPOSIT_RELAY` act on; on leaf the emission token is the leaf voter's `RECEIPT_TOKEN` and the staking      immutables stay zero. Derived values come from protocol contracts that validate them at their own      construction, so only the constructor's own inputs are zero-checked here.      A lite deployment ships without the voting system and without the cross-chain layer, so `_leafVoter` and      `_icaRouter` may be zero. A zero voter makes `IS_ROOT` false, leaves the emission token zero, and disables the      gauge staking and claim commands; a zero ICA router disables `EXECUTE_CROSS_CHAIN` and the `BRIDGE_TOKEN`      path that derives a destination interchain account. Those revert with `CommandDisabled` when dispatched,      while a `BRIDGE_TOKEN` naming a direct recipient stays available."},"msgSender()":{"returns":{"_sender":"Logical sender for the current batch."}},"execute(bytes,bytes[],uint256)":{"params":{"_inputs":"ABI-encoded arguments for each command.","_commands":"One byte per command, index-aligned with `_inputs`.","_deadline":"Timestamp after which the batch reverts."}},"uniswapV3SwapCallback(int256,int256,bytes)":{"params":{"_data":"Callback payer and input authorization encoded by the active swap command.","_amount0Delta":"Signed token0 amount owed to or sent by the pool.","_amount1Delta":"Signed token1 amount owed to or sent by the pool."}},"onERC721Received(address,address,uint256,bytes)":{"details":"Accepts a position only while a batch is active, and only when the calling collection, the sender, and the      position all match what the active command set through `MetarouterState.setExpectedNft`, then records the      `(collection, tokenId)` pair for the closing ownership check. A CL gauge returns unstaked positions through      `safeTransferFrom`, which is why the router implements the receiver.      This check is the custody boundary. A tracked position is one later commands may operate, so accepting an      unsolicited transfer would let a third party hand the active batch authority over a position it never asked      for. An unset slot reads zero and is rejected outright rather than compared, so a hook call reporting a zero      `_from` cannot slip through while the router expects nothing. Matching the token id too keeps a misbehaving      gauge from returning a different position than the one the command asked back.      The collection is matched rather than compared against a canonical manager: the router holds none, so each      command publishes the manager it resolved. Every argument here except `msg.sender` is chosen by the caller, so      without that comparison any contract could present the expected sender and token id and be recorded as a      custodied collection, and a position from one manager could satisfy state armed for another that issued the      same id."}},"version":1,"stateVariables":{"WETH":{"return":"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled.","returns":{"_0":"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled."}},"IS_ROOT":{"return":"True on the root deployment, false on a leaf.","details":"Gates the root-only `CREATE_STAKE` and `DEPOSIT_RELAY` commands; derived at construction from whether the      local chain id equals the orchestrator's `ROOT_CHAIN_ID`.","returns":{"_0":"True on the root deployment, false on a leaf."}},"ICA_ROUTER":{"return":"The interchain account router.","details":"The zero address on a lite deployment with no cross-chain layer, where every command that derives an      interchain account reverts with `CommandDisabled`. A `BRIDGE_TOKEN` naming a direct recipient never reads      this router, so it stays available there.","returns":{"_0":"The interchain account router."}},"LEAF_VOTER":{"return":"The leaf Voter.","details":"The zero address on a lite deployment with no voting system, where the gauge staking and claim commands      revert with `CommandDisabled`.","returns":{"_0":"The leaf Voter."}},"NATIVE_ERC20":{"return":"The native ERC20, or the zero address when the chain has none.","details":"The token's balance is the account's native balance expressed in the token's own decimals, so spend      resolution caps it at the batch's own native converted through `NATIVE_ERC20_SCALE`: spending the full      balance would drain the pre-batch native the batch must preserve and revert the closure.      The closing sweep skips its entry point entirely and returns the batch's portion through the native refund,      since some implementations reject a zero-value `transfer`; a recipient that rejects that refund is paid      through this entry point instead. On implementations that reject value-less transfers the ERC20-style      commands on this token revert mid-batch too; that is the token's own behavior, not the router's.      Never transfer or pre-fund this token ahead of `execute`: provide it as `msg.value` or pull it through      `FUND_ERC20` during the active batch. Value the router already holds when a batch opens counts as pre-batch      native, is excluded from batch custody, and cannot be recovered.","returns":{"_0":"The native ERC20, or the zero address when the chain has none."}},"STAKING_TOKEN":{"return":"The staking token, or the zero address on a leaf.","returns":{"_0":"The staking token, or the zero address on a leaf."}},"EMISSION_TOKEN":{"return":"The gauge-emissions token this router custodies and sweeps.","returns":{"_0":"The gauge-emissions token this router custodies and sweeps."}},"STAKING_ESCROW":{"return":"The VotingEscrow, or the zero address on a leaf.","returns":{"_0":"The VotingEscrow, or the zero address on a leaf."}},"FACTORY_REGISTRY":{"return":"Factory registry used by venue-sensitive commands.","returns":{"_0":"Factory registry used by venue-sensitive commands."}},"NATIVE_ERC20_SCALE":{"return":"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20.","details":"Some chains express the same native asset in different precisions per interface: eighteen decimals for      `address.balance` and `msg.value`, the token's own decimals for `balanceOf` and `transfer`. Every place      that mixes the two representations converts through this factor: the batch's spendable native — less any      committed message fee — converts to the native ERC20 decimals rounding down, so a full spend can never reach the      pre-batch native; a native refund paid through the native ERC20 also floors, leaving dust the token cannot      express. One on an eighteen-decimal native ERC20, where both interfaces share raw values.","returns":{"_0":"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20."}},"RELAY_FACTORY_REGISTRY":{"return":"The RelayFactoryRegistry, or the zero address on a leaf.","returns":{"_0":"The RelayFactoryRegistry, or the zero address on a leaf."}}}},"sourceIds":{"V3/src/metarouter/Metarouter.sol":{"id":41},"V3/src/interfaces/core/IVotes.sol":{"id":5},"V3/src/interfaces/pools/IPool.sol":{"id":24},"V3/src/interfaces/relay/IRelay.sol":{"id":26},"V3/src/interfaces/token/IToken.sol":{"id":34},"V3/src/interfaces/voter/IVoter.sol":{"id":37},"V3/src/interfaces/gauges/IGauge.sol":{"id":18},"V3/src/interfaces/pools/ICLPool.sol":{"id":23},"V3/src/interfaces/external/IWETH.sol":{"id":11},"V3/src/interfaces/minter/IMinter.sol":{"id":22},"V3/src/interfaces/gauges/ICLGauge.sol":{"id":17},"V3/src/interfaces/gauges/IV2Gauge.sol":{"id":19},"V3/src/interfaces/voter/ILeafVoter.sol":{"id":36},"V3/src/libraries/ProtocolConstants.sol":{"id":40},"V3/src/interfaces/relay/IRelayState.sol":{"id":29},"V3/src/interfaces/relay/IRelayToken.sol":{"id":30},"V3/src/metarouter/TransientTracking.sol":{"id":42},"V3/src/interfaces/core/IVotingEscrow.sol":{"id":6},"V3/src/interfaces/governor/IGovernor.sol":{"id":20},"V3/src/interfaces/voter/IVoterCommon.sol":{"id":38},"V3/src/metarouter/libraries/Commands.sol":{"id":46},"V3/src/metarouter/libraries/FundsLib.sol":{"id":48},"V3/src/metarouter/libraries/GaugeLib.sol":{"id":49},"V3/src/interfaces/relay/IRelayFactory.sol":{"id":27},"V3/src/metarouter/libraries/ClaimsLib.sol":{"id":45},"V3/src/metarouter/libraries/V2PoolLib.sol":{"id":56},"V3/src/interfaces/factories/ICLFactory.sol":{"id":12},"V3/src/interfaces/pools/tape/IPoolTape.sol":{"id":25},"V3/src/metarouter/libraries/StakingLib.sol":{"id":54},"V3/src/interfaces/external/ITokenRouter.sol":{"id":10},"V3/src/metarouter/libraries/PaymentsLib.sol":{"id":52},"V3/src/interfaces/bridge/IMessageAdapter.sol":{"id":2},"V3/src/interfaces/factories/IPoolFactory.sol":{"id":16},"V3/src/interfaces/metarouter/IMetarouter.sol":{"id":21},"V3/src/interfaces/token/ITokenExtensions.sol":{"id":35},"V3/src/metarouter/libraries/LiquidityLib.sol":{"id":50},"V3/src/interfaces/factories/IGaugeFactory.sol":{"id":15},"V3/src/interfaces/relay/IRelayVoteAdapter.sol":{"id":31},"V3/src/metarouter/libraries/ClPositionLib.sol":{"id":43},"V3/src/metarouter/libraries/ClResolverLib.sol":{"id":44},"V3/src/metarouter/libraries/CrosschainLib.sol":{"id":47},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"id":53},"V3/src/interfaces/vpm/IVoterPaymentsModule.sol":{"id":39},"V3/src/metarouter/libraries/TokenRouterLib.sol":{"id":55},"V3/src/interfaces/factories/ICLGaugeFactory.sol":{"id":13},"V3/src/metarouter/libraries/MetarouterState.sol":{"id":51},"V3/src/interfaces/factories/IFactoryRegistry.sol":{"id":14},"V3/src/interfaces/token/IBaseTokenExtensions.sol":{"id":32},"V3/src/interfaces/bridge/IMessageOrchestrator.sol":{"id":3},"V3/src/interfaces/relay/IRelayFactoryRegistry.sol":{"id":28},"V3/src/interfaces/token/IReceiptTokenExtensions.sol":{"id":33},"node_modules/@openzeppelin/contracts/utils/Panic.sol":{"id":72},"V3/src/interfaces/bridge/ILeafMessageOrchestrator.sol":{"id":1},"V3/src/interfaces/bridge/IRootMessageOrchestrator.sol":{"id":4},"V3/src/interfaces/external/IInterchainAccountRouter.sol":{"id":8},"node_modules/@openzeppelin/contracts/utils/math/Math.sol":{"id":74},"V3/src/interfaces/external/ICrossCollateralTokenRouter.sol":{"id":7},"V3/src/interfaces/external/INonfungiblePositionManager.sol":{"id":9},"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol":{"id":60},"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol":{"id":59},"node_modules/@openzeppelin/contracts/interfaces/IERC721.sol":{"id":63},"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol":{"id":64},"V3/src/interfaces/access/IGuardedAccessControlEnumerable.sol":{"id":0},"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol":{"id":58},"node_modules/@openzeppelin/contracts/interfaces/IERC4906.sol":{"id":61},"node_modules/@openzeppelin/contracts/interfaces/IERC6372.sol":{"id":62},"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol":{"id":75},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol":{"id":68},"node_modules/@openzeppelin/contracts/access/IAccessControl.sol":{"id":57},"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"id":67},"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol":{"id":73},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol":{"id":69},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol":{"id":66},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"id":65},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol":{"id":71},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol":{"id":70}},"additionalInput":null,"stdJsonInput":{"sources":{"V3/src/metarouter/Metarouter.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {IERC20Metadata} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport {IERC721Receiver} from '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\n\nimport {TransientTracking} from 'V3/metarouter/TransientTracking.sol';\nimport {ClPositionLib} from 'V3/metarouter/libraries/ClPositionLib.sol';\nimport {ClaimsLib} from 'V3/metarouter/libraries/ClaimsLib.sol';\nimport {Commands} from 'V3/metarouter/libraries/Commands.sol';\nimport {CrosschainLib} from 'V3/metarouter/libraries/CrosschainLib.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {LiquidityLib} from 'V3/metarouter/libraries/LiquidityLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {PaymentsLib} from 'V3/metarouter/libraries/PaymentsLib.sol';\nimport {StakeRelayLib} from 'V3/metarouter/libraries/StakeRelayLib.sol';\nimport {StakingLib} from 'V3/metarouter/libraries/StakingLib.sol';\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IInterchainAccountRouter} from 'V3/interfaces/external/IInterchainAccountRouter.sol';\nimport {IWETH} from 'V3/interfaces/external/IWETH.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IPoolFactory} from 'V3/interfaces/factories/IPoolFactory.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ICLPool} from 'V3/interfaces/pools/ICLPool.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\nimport {IRelayFactoryRegistry} from 'V3/interfaces/relay/IRelayFactoryRegistry.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\n\n/**\n * @title Metarouter\n * @notice Permissionless router for executing composable command batches with temporary asset custody,\n *         returning remaining batch ERC20 and native balances to the original caller when execution ends. Positions\n *         are not returned: one brought into custody must be sent onward by a later command, or closure reverts.\n * @dev Virtual functions allow future variants to inherit from this contract and override selected behavior.\n */\ncontract Metarouter is IMetarouter, IERC721Receiver {\n  using SafeERC20 for IERC20;\n\n  /// @notice Canonical pool-type label reported by V2 stable pools.\n  bytes32 internal constant _V2_STABLE_POOL_TYPE = 'V2_STABLE';\n  /// @notice Canonical pool-type label reported by V2 volatile pools.\n  bytes32 internal constant _V2_VOLATILE_POOL_TYPE = 'V2_VOLATILE';\n  /// @notice Canonical pool-type label reported by CL pools.\n  bytes32 internal constant _CL_POOL_TYPE = 'CL';\n  /// @notice Lowest usable CL square-root price, one unit above the pool boundary.\n  uint160 internal constant _MIN_SQRT_RATIO_PLUS_ONE = 4_295_128_740;\n  /// @notice Highest usable CL square-root price, one unit below the pool boundary.\n  uint160 internal constant _MAX_SQRT_RATIO_MINUS_ONE =\n    1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_341;\n\n  /// @notice Address this router was deployed at; `_checkExecutionContext` uses it to reject delegatecalls.\n  address internal immutable _IMPLEMENTATION = address(this);\n\n  /// @inheritdoc IMetarouter\n  IWETH public immutable WETH;\n  /// @inheritdoc IMetarouter\n  ILeafVoter public immutable LEAF_VOTER;\n  /// @inheritdoc IMetarouter\n  IERC20 public immutable EMISSION_TOKEN;\n  /// @inheritdoc IMetarouter\n  IInterchainAccountRouter public immutable ICA_ROUTER;\n  /// @inheritdoc IMetarouter\n  IFactoryRegistry public immutable FACTORY_REGISTRY;\n  /// @inheritdoc IMetarouter\n  bool public immutable IS_ROOT;\n  /// @inheritdoc IMetarouter\n  IVotingEscrow public immutable STAKING_ESCROW;\n  /// @inheritdoc IMetarouter\n  IERC20 public immutable STAKING_TOKEN;\n  /// @inheritdoc IMetarouter\n  IRelayFactoryRegistry public immutable RELAY_FACTORY_REGISTRY;\n  /// @inheritdoc IMetarouter\n  IERC20 public immutable NATIVE_ERC20;\n  /// @inheritdoc IMetarouter\n  uint256 public immutable NATIVE_ERC20_SCALE;\n\n  /**\n   * @notice Initializes the Metarouter.\n   * @dev The emission token and the staking escrow are derived from the protocol, not passed. On root (this chain\n   *      equals the leaf voter's orchestrator `ROOT_CHAIN_ID`) the emission token is the root Voter's `MINTER().TOKEN()`\n   *      and the staking escrow is the root Voter's `VOTING_ESCROW()`, the canonical escrow `CREATE_STAKE` and\n   *      `DEPOSIT_RELAY` act on; on leaf the emission token is the leaf voter's `RECEIPT_TOKEN` and the staking\n   *      immutables stay zero. Derived values come from protocol contracts that validate them at their own\n   *      construction, so only the constructor's own inputs are zero-checked here.\n   *\n   *      A lite deployment ships without the voting system and without the cross-chain layer, so `_leafVoter` and\n   *      `_icaRouter` may be zero. A zero voter makes `IS_ROOT` false, leaves the emission token zero, and disables the\n   *      gauge staking and claim commands; a zero ICA router disables `EXECUTE_CROSS_CHAIN` and the `BRIDGE_TOKEN`\n   *      path that derives a destination interchain account. Those revert with `CommandDisabled` when dispatched,\n   *      while a `BRIDGE_TOKEN` naming a direct recipient stays available.\n   * @param _weth Wrapped native token used by payment commands. Zero on a chain with no wrapped-native token, where\n   *        `WRAP_ETH` and `UNWRAP_WETH` revert with `CommandDisabled`. Never the native ERC20.\n   * @param _leafVoter Leaf Voter used to validate gauge targets and, on leaf, to resolve the emission `ReceiptToken`.\n   *        Zero on a lite deployment with no voting system, where the gauge staking and claim commands are disabled.\n   * @param _rootVoter Root Voter used only on root to resolve the emission token and the staking escrow; unused on leaf.\n   * @param _icaRouter Interchain account router used by the cross-chain commands. Zero on a lite deployment with no\n   *        cross-chain layer, where every command that derives an interchain account is disabled.\n   * @param _relayFactoryRegistry RelayFactoryRegistry used only on root to authenticate `DEPOSIT_RELAY` relays through\n   *        their factory; unused on leaf.\n   * @param _factoryRegistry Registry used to authenticate recorded pools and CL factories, require factory approval\n   *        for pool creation, and resolve permanent factory relationships backing position managers.\n   * @param _nativeErc20 ERC20 entry point of the chain's native asset, whose spend resolution and closing sweep are\n   *        capped so they cannot drain the pre-batch native balance. Zero on a chain whose native asset has no ERC20\n   *        entry point. A nonzero native ERC20 must report its decimals: the native-to-token scale is derived from\n   *        them, so a native ERC20 expressing the native asset in fewer decimals than native's eighteen converts correctly.\n   */\n  constructor(\n    IWETH _weth,\n    ILeafVoter _leafVoter,\n    IVoter _rootVoter,\n    IInterchainAccountRouter _icaRouter,\n    IRelayFactoryRegistry _relayFactoryRegistry,\n    IFactoryRegistry _factoryRegistry,\n    IERC20 _nativeErc20\n  ) {\n    if (address(_factoryRegistry) == address(0)) revert ZeroAddress();\n    WETH = _weth;\n    LEAF_VOTER = _leafVoter;\n    ICA_ROUTER = _icaRouter;\n    FACTORY_REGISTRY = _factoryRegistry;\n    NATIVE_ERC20 = _nativeErc20;\n    if (address(_nativeErc20) != address(0)) {\n      // The two roles are incompatible: wrap and unwrap would drive `deposit`/`withdraw` on the native ERC20 while the\n      // closing sweep treats the two tokens differently, so a collision is a misdeployment.\n      if (address(_weth) == address(_nativeErc20)) revert WethIsNativeErc20();\n      // Native balances always carry eighteen decimals; a native ERC20 may expose the same asset in fewer. Deriving the\n      // scale from the token's own decimals keeps the two unit systems convertible without a separate parameter.\n      uint8 _nativeErc20Decimals = IERC20Metadata(address(_nativeErc20)).decimals();\n      if (_nativeErc20Decimals > 18) revert InvalidNativeErc20Decimals();\n      NATIVE_ERC20_SCALE = 10 ** (18 - _nativeErc20Decimals);\n    }\n    // A lite deployment has no voter to ask, so it is never the root: the root-only commands stay gated off.\n    IS_ROOT = address(_leafVoter) != address(0) && block.chainid == _leafVoter.ORCHESTRATOR().ROOT_CHAIN_ID();\n\n    if (IS_ROOT) {\n      if (address(_rootVoter) == address(0)) revert ZeroAddress();\n      if (address(_relayFactoryRegistry) == address(0)) revert ZeroAddress();\n      EMISSION_TOKEN = IERC20(_rootVoter.MINTER().TOKEN());\n      STAKING_ESCROW = _rootVoter.VOTING_ESCROW();\n      STAKING_TOKEN = IERC20(address(STAKING_ESCROW.TOKEN()));\n      RELAY_FACTORY_REGISTRY = _relayFactoryRegistry;\n    } else {\n      // Leaf: no VotingEscrow or Relay, so the staking immutables stay zero and IS_ROOT gates their commands off.\n      // A lite deployment has no voter to resolve the receipt token from, so the emission token stays zero too.\n      if (address(_leafVoter) != address(0)) EMISSION_TOKEN = IERC20(address(_leafVoter.RECEIPT_TOKEN()));\n    }\n  }\n\n  /// @notice Accepts WETH withdrawals and native refunds received during an active batch.\n  receive() external payable virtual {\n    // WETH withdrawals are always accepted. Other native inflows are accepted only while an\n    // outer batch is active and are returned at closure.\n    if (msg.sender != address(WETH) && TransientTracking.load(MetarouterState.LOCKER_SLOT) == 0) {\n      revert InvalidEthSender();\n    }\n  }\n\n  /**\n   * @inheritdoc IERC721Receiver\n   * @dev Accepts a position only while a batch is active, and only when the calling collection, the sender, and the\n   *      position all match what the active command set through `MetarouterState.setExpectedNft`, then records the\n   *      `(collection, tokenId)` pair for the closing ownership check. A CL gauge returns unstaked positions through\n   *      `safeTransferFrom`, which is why the router implements the receiver.\n   *\n   *      This check is the custody boundary. A tracked position is one later commands may operate, so accepting an\n   *      unsolicited transfer would let a third party hand the active batch authority over a position it never asked\n   *      for. An unset slot reads zero and is rejected outright rather than compared, so a hook call reporting a zero\n   *      `_from` cannot slip through while the router expects nothing. Matching the token id too keeps a misbehaving\n   *      gauge from returning a different position than the one the command asked back.\n   *\n   *      The collection is matched rather than compared against a canonical manager: the router holds none, so each\n   *      command publishes the manager it resolved. Every argument here except `msg.sender` is chosen by the caller, so\n   *      without that comparison any contract could present the expected sender and token id and be recorded as a\n   *      custodied collection, and a position from one manager could satisfy state armed for another that issued the\n   *      same id.\n   */\n  function onERC721Received(\n    address,\n    address _from,\n    uint256 _tokenId,\n    bytes calldata\n  ) external virtual returns (bytes4 _selector) {\n    if (TransientTracking.load(MetarouterState.LOCKER_SLOT) == 0) revert BatchNotActive();\n    (address _expectedCollection, address _expectedSender, uint256 _expectedTokenId) = MetarouterState.expectedNft();\n    // Checked before the collection so an unsolicited transfer, which finds every field zero, reports that the router\n    // solicited nothing rather than naming a collection mismatch.\n    if (_expectedSender == address(0)) revert UnexpectedNftSender();\n    if (msg.sender != _expectedCollection) revert InvalidNftSender();\n    if (_from != _expectedSender) revert UnexpectedNftSender();\n    if (_tokenId != _expectedTokenId) revert UnexpectedNftSender();\n    // Consume the one-shot authorization before recording custody. The initiating withdrawal requires this state to\n    // be cleared when the gauge returns, so a successful call proves that this exact receiver path ran.\n    MetarouterState.clearExpectedNft();\n    MetarouterState.trackNft(msg.sender, _tokenId);\n    return IERC721Receiver.onERC721Received.selector;\n  }\n\n  // ============================== Execution ==============================\n\n  /// @inheritdoc IMetarouter\n  function execute(bytes calldata _commands, bytes[] calldata _inputs, uint256 _deadline) external payable virtual {\n    _checkExecutionContext();\n    if (_commands.length != _inputs.length) revert LengthMismatch();\n    if (block.timestamp > _deadline) revert Expired();\n\n    if (TransientTracking.load(MetarouterState.LOCKER_SLOT) != 0) {\n      // While a batch is active, only the router's own self-called child frames may reenter.\n      if (msg.sender != address(this)) revert ContractLocked();\n      _executeCommands(_commands, _inputs);\n      return;\n    }\n\n    _beginExecution();\n    address _sender = MetarouterState.msgSender();\n    _executeCommands(_commands, _inputs);\n    _endExecution(_sender);\n    emit BatchExecuted(_sender);\n  }\n\n  /// @inheritdoc IMetarouter\n  function uniswapV3SwapCallback(int256 _amount0Delta, int256 _amount1Delta, bytes calldata _data) external virtual {\n    _checkExecutionContext();\n    // No locker check needed: the expected callback caller slot can only be armed while a batch swap is executing.\n    address _expectedCaller = address(uint160(TransientTracking.load(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT)));\n    if (msg.sender != _expectedCaller) revert InvalidCallbackCaller(msg.sender);\n    TransientTracking.store(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT, 0);\n\n    // Exactly one delta is positive: the token owed to the pool.\n    bool _amount0Positive = _amount0Delta > 0;\n    bool _amount1Positive = _amount1Delta > 0;\n    if (_amount0Positive == _amount1Positive) revert InvalidCallbackDeltas();\n\n    uint256 _amountToPay = uint256(_amount0Positive ? _amount0Delta : _amount1Delta);\n    ClSwapCallbackData memory _callback = abi.decode(_data, (ClSwapCallbackData));\n\n    // Settle the invoice by swapping the previous route pool's exact output straight to the caller.\n    if (_callback.remaining > 0) {\n      uint256 _hop = --_callback.remaining;\n      // The caller pool verifies its own balance afterwards, so a partial inner fill makes it revert.\n      _clSwap(\n        _callback.pools[_hop], _callback.zeroForOne[_hop], -int256(_amountToPay), msg.sender, abi.encode(_callback)\n      );\n      return;\n    }\n\n    // Reverts if the pool requests more than the authorized maximum.\n    if (_amountToPay > _callback.maxAmountIn) revert TooMuchRequested();\n    FundsLib.pay(_callback.tokenIn, _callback.payer, msg.sender, _amountToPay);\n  }\n\n  /// @inheritdoc IMetarouter\n  function msgSender() external view virtual override returns (address _sender) {\n    return MetarouterState.msgSender();\n  }\n\n  /**\n   * @notice Executes commands without opening or closing another custody frame.\n   * @param _commands One command byte per input.\n   * @param _inputs ABI-encoded arguments corresponding to each command byte.\n   */\n  function _executeCommands(bytes calldata _commands, bytes[] calldata _inputs) internal virtual {\n    uint256 _length = _commands.length;\n    for (uint256 _i; _i < _length; ++_i) {\n      (uint256 _commandType, bool _allowRevert) = _decode(_commands[_i]);\n      if (!_allowRevert) {\n        _dispatch(_commandType, _inputs[_i]);\n      } else {\n        bytes memory _childCommands = abi.encodePacked(bytes1(uint8(_commandType)));\n        bytes[] memory _childInputs = new bytes[](1);\n        _childInputs[0] = _inputs[_i];\n        // Run in a fresh frame so a failure rolls back the command's state changes while the batch continues.\n        try this.execute(_childCommands, _childInputs, type(uint256).max) {} catch {}\n      }\n    }\n  }\n\n  /**\n   * @notice Opens the batch: records the outer caller as locker, snapshots the pre-batch native balance, and\n   *         publishes the native ERC20 for balance resolution.\n   */\n  function _beginExecution() internal virtual {\n    TransientTracking.store(MetarouterState.LOCKER_SLOT, uint256(uint160(msg.sender)));\n    TransientTracking.store(MetarouterState.NATIVE_BALANCE_BEFORE_SLOT, address(this).balance - msg.value);\n    // The command libraries run via delegatecall and cannot read the immutables, so `availableErc20Balance` reads\n    // the native ERC20 token and its scale from these slots. Skipped when zero: no token ever matches an empty slot.\n    if (address(NATIVE_ERC20) != address(0)) {\n      TransientTracking.store(MetarouterState.NATIVE_ERC20_SLOT, uint256(uint160(address(NATIVE_ERC20))));\n      TransientTracking.store(MetarouterState.NATIVE_ERC20_SCALE_SLOT, NATIVE_ERC20_SCALE);\n    }\n  }\n\n  /**\n   * @notice Returns every tracked ERC20 balance and any batch ETH to the recipient, verifies no tracked NFT remains,\n   *         then clears custody and the locker.\n   * @dev Tracked ERC20s are swept back to the recipient. The native ERC20 is skipped: its balance is the\n   *      router's native balance, so the native refund below already returns the batch's portion, and sweeping it\n   *      through the ERC20 entry point would drain the pre-batch native — or revert outright on an implementation\n   *      that demands a value-carrying `transfer`. A recipient that rejects the native refund is paid through the\n   *      native ERC20's entry point instead, so a custody-holding contract without a payable receiver still gets the batch\n   *      native back; without a native ERC20 the rejection reverts the closure. NFTs are checked rather than swept: a\n   *      position still owned by\n   *      the router means the route left it stranded, so closure reverts; a command that transferred it out (staked,\n   *      deposited, transferred) leaves the router as its non-owner, so the check passes. `BURN_CL_POSITION` untracks a\n   *      position it burns, so the ownership check skips it. A recipient may instead burn a transferred position from\n   *      its receiver hook while its custody flag remains set; in that case `ownerOf` reverting at closure proves that\n   *      the canonical position no longer exists and is treated as having left. Closure deliberately does not touch the\n   *      in-flight slots: every command that moves a tracked position out of the router must call\n   *      `MetarouterState.consumeInFlightNft` itself. Miss that and the stale pair survives into a later batch of the\n   *      same transaction, where the next producer command reverts with `InFlightNftPresent`.\n   * @param _recipient Address receiving the swept balances and ETH refund at closure.\n   */\n  function _endExecution(address _recipient) internal virtual {\n    uint256 _length = TransientTracking.length(MetarouterState.ERC20_ARRAY_SLOT);\n    for (uint256 _i; _i < _length; ++_i) {\n      address _token = TransientTracking.at(MetarouterState.ERC20_ARRAY_SLOT, _i);\n      TransientTracking.untrack(MetarouterState.TRACKED_SLOT, _token);\n      // The native ERC20's batch portion is native value the refund below already returns, and some native ERC20\n      // implementations reject a zero-value `transfer`, so its entry point is never swept.\n      if (_token == address(NATIVE_ERC20)) continue;\n      uint256 _balance = IERC20(_token).balanceOf(address(this));\n      if (_balance > 0) IERC20(_token).safeTransfer(_recipient, _balance);\n    }\n    TransientTracking.clear(MetarouterState.ERC20_ARRAY_SLOT);\n\n    uint256 _nativeRefund = MetarouterState.availableNativeBalance();\n    // slither-disable-next-line uninitialized-local\n    uint256 _allowedDust;\n    if (_nativeRefund > 0) {\n      (bool _success, bytes memory _data) = payable(_recipient).call{value: _nativeRefund}('');\n      if (!_success) {\n        // A rejecting recipient is paid through the native ERC20's entry point instead, which moves the same native\n        // without running their code; without a native ERC20 the rejection surfaces. The refund floors to raw\n        // native ERC20 units: the untransferable remainder is tolerated below and absorbed by the next batch's snapshot.\n        // If the native ERC20 also rejects, the native failure is re-raised with its original data.\n        if (address(NATIVE_ERC20) == address(0)) revert NativeTransferFailed(_data);\n        uint256 _refundAmount = _nativeRefund / NATIVE_ERC20_SCALE;\n        if (_refundAmount > 0 && !NATIVE_ERC20.trySafeTransfer(_recipient, _refundAmount)) {\n          revert NativeTransferFailed(_data);\n        }\n        _allowedDust = NATIVE_ERC20_SCALE - 1;\n      }\n    }\n    // A recipient that bounced native back into the router during the refund would leave a spendable balance behind;\n    // reject it so no native survives the batch beyond the remainder a native ERC20 refund cannot express.\n    // Post-refund the balance can only be at or above the pre-batch snapshot, so any residual surfaces as a non-zero\n    // available balance.\n    if (MetarouterState.availableNativeBalance() > _allowedDust) revert NativeBalanceNotCleared();\n\n    // The arrays are an append-only log of every position the batch touched; the per-NFT flag is the live \"still the\n    // router's responsibility\" bit. `trackNft` appends only when the flag is unset, so every entry is unique, and a\n    // command that releases a position clears its flag while its array entry stays behind.\n    uint256 _nftLength = MetarouterState.trackedNftLength();\n    for (uint256 _i; _i < _nftLength; ++_i) {\n      (address _collection, uint256 _tokenId) = MetarouterState.trackedNftAt(_i);\n      // Flag already cleared: the position was released mid-batch. Today only `BURN_CL_POSITION` does that, so the\n      // token no longer exists and `ownerOf` would revert on it. Nothing left to verify.\n      if (!MetarouterState.isNftInCustody(_collection, _tokenId)) continue;\n      try IERC721(_collection).ownerOf(_tokenId) returns (address _closureOwner) {\n        // Still owned by the router: the route brought the position in and never sent it on, so revert the whole batch\n        // rather than close and leave it trapped here.\n        if (_closureOwner == address(this)) revert NftNotCleared();\n      } catch {\n        // Custody admits only collections authenticated by a command or explicitly armed for a gauge return. Their\n        // `ownerOf` implementations have no application-level revert path for an existing token, so a revert is\n        // treated as the position having burned.\n      }\n      // It left the router. Clearing the flag is load-bearing, not housekeeping: `clearNftArrays` resets only the\n      // array lengths, so a flag surviving into a later batch of the same transaction would make that batch's\n      // `trackNft` dedupe the position away, leaving it out of the array and unverified at that batch's closure.\n      MetarouterState.untrackNft(_collection, _tokenId);\n    }\n    MetarouterState.clearNftArrays();\n\n    TransientTracking.store(MetarouterState.NATIVE_BALANCE_BEFORE_SLOT, 0);\n    TransientTracking.store(MetarouterState.LOCKER_SLOT, 0);\n  }\n\n  // ============================== Dispatch ==============================\n\n  /**\n   * @notice Routes a command to its handler, keeping control-flow commands inline and delegating group commands\n   *         to their libraries.\n   * @dev This function is the single validated boundary: an unknown command reverts here.\n   * @param _commandType Command ID with flags removed.\n   * @param _input ABI-encoded arguments for the command.\n   */\n  function _dispatch(uint256 _commandType, bytes calldata _input) internal virtual {\n    // Swaps stay inline because this hot path fits, other command groups use libraries to stay within the size limit.\n    if (_commandType == Commands.CL_SWAP_EXACT_IN) {\n      _clSwapExactIn(_input);\n    } else if (_commandType == Commands.CL_SWAP_EXACT_OUT) {\n      _clSwapExactOut(_input);\n    } else if (_commandType == Commands.V2_SWAP_EXACT_IN) {\n      _v2SwapExactIn(_input);\n    } else if (_commandType == Commands.V2_SWAP_EXACT_OUT) {\n      _v2SwapExactOut(_input);\n    }\n    // Control flow\n    else if (_commandType == Commands.EXECUTE_SUB_PLAN) {\n      _executeSubPlan(_input);\n    } else if (_commandType == Commands.BALANCE_CHECK) {\n      _balanceCheck(_input);\n    }\n    // Payments\n    else if (_commandType == Commands.SWEEP) {\n      PaymentsLib.sweep(_input);\n    } else if (_commandType == Commands.TRANSFER) {\n      PaymentsLib.transfer(_input);\n    } else if (_commandType == Commands.FUND_ERC20) {\n      PaymentsLib.fundErc20(_input);\n    } else if (_commandType == Commands.WRAP_ETH) {\n      if (address(WETH) == address(0)) revert CommandDisabled(_commandType);\n      PaymentsLib.wrapEth(_input, WETH);\n    } else if (_commandType == Commands.UNWRAP_WETH) {\n      if (address(WETH) == address(0)) revert CommandDisabled(_commandType);\n      PaymentsLib.unwrapWeth(_input, WETH);\n    } else if (_commandType == Commands.TRANSFER_NFT) {\n      PaymentsLib.transferNft(_input);\n    }\n    // CL positions\n    else if (_commandType == Commands.MINT_CL_POSITION) {\n      ClPositionLib.mintClPosition(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.INCREASE_CL_LIQUIDITY) {\n      ClPositionLib.increaseClLiquidity(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.DECREASE_CL_LIQUIDITY) {\n      ClPositionLib.decreaseClLiquidity(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.COLLECT_CL_FEES) {\n      ClPositionLib.collectClFees(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.BURN_CL_POSITION) {\n      ClPositionLib.burnClPosition(_input, FACTORY_REGISTRY);\n    }\n    // V2 liquidity\n    else if (_commandType == Commands.ADD_LIQUIDITY) {\n      LiquidityLib.addLiquidity(_input, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.REMOVE_LIQUIDITY) {\n      LiquidityLib.removeLiquidity(_input, FACTORY_REGISTRY);\n    }\n    // Staking\n    else if (_commandType == Commands.STAKE_GAUGE) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      StakingLib.stakeGauge(_input, LEAF_VOTER, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.UNSTAKE_GAUGE) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      StakingLib.unstakeGauge(_input, LEAF_VOTER, EMISSION_TOKEN, FACTORY_REGISTRY);\n    }\n    // Claims\n    else if (_commandType == Commands.CLAIM_GAUGE_REWARDS) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      ClaimsLib.claimGaugeRewards(_input, LEAF_VOTER, EMISSION_TOKEN, FACTORY_REGISTRY);\n    } else if (_commandType == Commands.CLAIM_V2_POOL_FEES) {\n      ClaimsLib.claimV2PoolFees(_input, FACTORY_REGISTRY);\n    }\n    // Cross-chain\n    else if (_commandType == Commands.BRIDGE_TOKEN) {\n      CrosschainLib.bridgeToken(_input, ICA_ROUTER);\n    } else if (_commandType == Commands.EXECUTE_CROSS_CHAIN) {\n      if (address(ICA_ROUTER) == address(0)) revert CommandDisabled(_commandType);\n      CrosschainLib.executeCrosschain(_input, ICA_ROUTER);\n    }\n    // `REDEEM` is leaf-only: root pays gauge emissions in `TOKEN` directly, so it holds no receipt to redeem and\n    // `EMISSION_TOKEN` is the canonical `TOKEN` there, not the `ReceiptToken` the leaf Voter burns.\n    else if (_commandType == Commands.REDEEM) {\n      if (address(LEAF_VOTER) == address(0)) revert CommandDisabled(_commandType);\n      if (IS_ROOT) revert NotLeaf(_commandType);\n      CrosschainLib.redeem(_input, LEAF_VOTER, EMISSION_TOKEN);\n    }\n    // sAERO / relay\n    // `CREATE_STAKE` and `DEPOSIT_RELAY` are root-only: the `VotingEscrow` and the relays exist only on the root\n    // deployment. On a leaf `IS_ROOT` is false, so `!IS_ROOT` is true and the command reverts.\n    else if (_commandType == Commands.CREATE_STAKE) {\n      if (!IS_ROOT) revert NotRoot(_commandType);\n      StakeRelayLib.createStake(_input, STAKING_ESCROW, STAKING_TOKEN);\n    } else if (_commandType == Commands.DEPOSIT_RELAY) {\n      if (!IS_ROOT) revert NotRoot(_commandType);\n      StakeRelayLib.depositRelay(_input, STAKING_ESCROW, RELAY_FACTORY_REGISTRY);\n    } else {\n      revert InvalidCommandType(_commandType);\n    }\n  }\n\n  // ============================== Swaps ==============================\n\n  /**\n   * @notice Executes a forward-ordered exact-input CL route.\n   * @dev The CL pool applies its contextual swap fee, including any configured MEV fee, and reports the resulting\n   *      input/output deltas through the callback and return values. Fee-on-transfer and other nonstandard pool\n   *      tokens are unsupported; routing and the minimum-output check use the canonical pool-reported deltas.\n   * @param _input ABI-encoded `SwapExactInParams`.\n   */\n  function _clSwapExactIn(bytes calldata _input) internal {\n    SwapExactInParams memory _params = abi.decode(_input, (SwapExactInParams));\n    // A user payer must specify an exact amount given wallet percentages are not resolvable.\n    if (_params.payerIsUser && _params.amountIn.mode != SpendMode.Amount) revert InvalidSpendMode();\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, true, _params.recipient);\n    uint256 _length = _params.pools.length;\n\n    // The user pays the first pool directly, or the execution address funds it.\n    uint256 _amountIn =\n      _params.payerIsUser ? _params.amountIn.value : FundsLib.fund(_params.tokenIn, _params.amountIn, false);\n    // Reverts if the first hop's user-supplied or funded input does not fit the pool's signed input type.\n    if (_amountIn > uint256(type(int256).max)) revert AmountOverflow();\n    address _payer = _params.payerIsUser ? MetarouterState.msgSender() : address(this);\n\n    // Exact-input callbacks never recurse through an earlier pool, so every hop reuses the same empty route arrays.\n    address[] memory _emptyPools = new address[](0);\n    bool[] memory _emptyZeroForOne = new bool[](0);\n\n    // Execute the swaps route.\n    for (uint256 _i; _i < _length; ++_i) {\n      // Send intermediate outputs to the metarouter and the final output to the recipient.\n      address _recipient = _i + 1 == _length ? _params.recipient : address(this);\n      if (_recipient == address(this)) MetarouterState.trackERC20(_tokens[_i + 1]);\n\n      // Authorize the pool callback, bound what it may pay, and execute the swap.\n      ClSwapCallbackData memory _callback = ClSwapCallbackData({\n        pools: _emptyPools,\n        zeroForOne: _emptyZeroForOne,\n        remaining: 0,\n        tokenIn: _tokens[_i],\n        payer: _payer,\n        maxAmountIn: _amountIn\n      });\n      (int256 _amount0, int256 _amount1) =\n        _clSwap(_params.pools[_i], _zeroForOne[_i], int256(_amountIn), _recipient, abi.encode(_callback));\n\n      // The negative output delta (amount out we swapped) magnitude becomes the next hop's input.\n      int256 _outputDelta = _zeroForOne[_i] ? _amount1 : _amount0;\n      if (_outputDelta > 0) revert InvalidSwapDeltas();\n      // Convert into positive and cast (safe to negate: no pool can send close to `type(int256).min`).\n      _amountIn = uint256(-_outputDelta);\n\n      // The execution address pays the following pools.\n      _payer = address(this);\n    }\n\n    // Reverts if the minimum received amount out is not met.\n    if (_amountIn < _params.minAmountOut) revert TooLittleReceived(_params.minAmountOut, _amountIn);\n  }\n\n  /**\n   * @notice Executes a forward-ordered exact-output CL route.\n   * @dev The last pool executes first and each pool's invoice is settled inside its callback by swapping the\n   *      previous route pool straight to it, so the payer only pays the first pool's invoice. That payment happens\n   *      lazily inside the callback with no upfront funding: the execution owner pays directly, or the execution\n   *      address pays from custody. Fee-on-transfer and other nonstandard pool tokens are unsupported.\n   * @param _input ABI-encoded `SwapExactOutParams`.\n   */\n  function _clSwapExactOut(bytes calldata _input) internal {\n    SwapExactOutParams memory _params = abi.decode(_input, (SwapExactOutParams));\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, true, _params.recipient);\n    uint256 _lastIndex = _params.pools.length - 1;\n\n    // If the final recipient is the Metarouter, track the output token.\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_tokens[_lastIndex + 1]);\n\n    // Reverts if the output amount does not fit the pool's signed amount type.\n    if (_params.amountOut > uint256(type(int256).max)) revert AmountOverflow();\n\n    // The user pays the first pool's invoice directly, or the execution address pays it from custody.\n    address _payer = _params.payerIsUser ? MetarouterState.msgSender() : address(this);\n    // Track custody-funded inputs so any unspent residual is swept back at batch closure.\n    if (!_params.payerIsUser) MetarouterState.trackERC20(_params.tokenIn);\n\n    // The route before the last pool settles its invoice recursively through the callback.\n    ClSwapCallbackData memory _callback = ClSwapCallbackData({\n      pools: _params.pools,\n      zeroForOne: _zeroForOne,\n      remaining: _lastIndex,\n      tokenIn: _params.tokenIn,\n      payer: _payer,\n      maxAmountIn: _params.maxAmountIn\n    });\n    (int256 _amount0, int256 _amount1) = _clSwap(\n      _params.pools[_lastIndex],\n      _zeroForOne[_lastIndex],\n      -int256(_params.amountOut),\n      _params.recipient,\n      abi.encode(_callback)\n    );\n\n    // Reverts if the pool delivers a different output than the exact requested amount.\n    int256 _outputDelta = _zeroForOne[_lastIndex] ? _amount1 : _amount0;\n    if (uint256(-_outputDelta) != _params.amountOut) revert InvalidAmountOut();\n  }\n\n  /**\n   * @notice Executes a forward-ordered exact-input V2 route through stable and volatile pools.\n   * @dev Each hop measures the input its pool actually received. Slippage is checked twice against `minAmountOut`:\n   *      the final hop's quote, before the swap runs, which an inflow to the recipient cannot inflate, and the\n   *      recipient balance delta as a backstop for an output token that under-delivers on transfer. Fee-on-transfer\n   *      and other nonstandard output tokens are unsupported: for them the quote is not a delivery guarantee and the\n   *      delta backstop might not be enough.\n   * @param _input ABI-encoded `SwapExactInParams`.\n   */\n  // slither-disable-start reentrancy-balance\n  function _v2SwapExactIn(bytes calldata _input) internal {\n    SwapExactInParams memory _params = abi.decode(_input, (SwapExactInParams));\n    // A user payer must specify an exact amount given wallet percentages are not resolvable.\n    if (_params.payerIsUser && _params.amountIn.mode != SpendMode.Amount) revert InvalidSpendMode();\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, false, _params.recipient);\n\n    // If the final recipient is the Metarouter, track the output token.\n    uint256 _length = _params.pools.length;\n    address _tokenOut = _tokens[_length];\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_tokenOut);\n\n    // The user pays the first pool directly, or the execution address funds it.\n    uint256 _amountIn =\n      _params.payerIsUser ? _params.amountIn.value : FundsLib.fund(_params.tokenIn, _params.amountIn, false);\n    FundsLib.pay(\n      _params.tokenIn, _params.payerIsUser ? MetarouterState.msgSender() : address(this), _params.pools[0], _amountIn\n    );\n\n    uint256 _balanceBefore = 0;\n\n    // Execute the swaps route.\n    for (uint256 _i; _i < _length; ++_i) {\n      uint256 _actualAmountIn;\n      {\n        // Measure the input amount received by the pool.\n        // slither-disable-next-line unused-return\n        (uint256 _reserve0, uint256 _reserve1,) = IPool(_params.pools[_i]).getReserves();\n        uint256 _reserveIn = _zeroForOne[_i] ? _reserve0 : _reserve1;\n        uint256 _poolBalance = IERC20(_tokens[_i]).balanceOf(_params.pools[_i]);\n        if (_poolBalance < _reserveIn) revert InvalidReserves(_params.pools[_i]);\n        _actualAmountIn = _poolBalance - _reserveIn;\n      }\n\n      // Route intermediate output to the next pool and final output to the recipient after snapshotting its balance.\n      uint256 _amountOut = IPool(_params.pools[_i]).getAmountOutWithTotalFee(_actualAmountIn, _tokens[_i]);\n      address _recipient;\n      if (_i + 1 < _length) {\n        _recipient = _params.pools[_i + 1];\n      } else {\n        // The quote cannot be inflated by an inflow to the recipient, so it enforces the minimum before the swap runs.\n        if (_amountOut < _params.minAmountOut) revert TooLittleReceived(_params.minAmountOut, _amountOut);\n        _recipient = _params.recipient;\n        // Snapshot immediately before the final swap so earlier route inflows cannot inflate the received amount.\n        _balanceBefore = IERC20(_tokenOut).balanceOf(_recipient);\n      }\n      _v2Swap(_params.pools[_i], _zeroForOne[_i], _amountOut, _recipient);\n    }\n\n    // Reverts if the minimum received amount out is not met.\n    uint256 _received = IERC20(_tokenOut).balanceOf(_params.recipient) - _balanceBefore;\n    if (_received < _params.minAmountOut) revert TooLittleReceived(_params.minAmountOut, _received);\n  }\n\n  // slither-disable-end reentrancy-balance\n\n  /**\n   * @notice Executes a forward-ordered exact-output V2 route through stable and volatile pools.\n   * @dev Each hop's required input is quoted backwards from the exact output by the pool itself, which applies its\n   *      own curve and total contextual fee, so both stable and volatile pools are supported. All hops are quoted\n   *      upfront; if an earlier hop increases a later hop's fee, that hop is underfunded and the route reverts.\n   *      The final recipient's balance delta must cover the exact requested output, so nonstandard output tokens that\n   *      under-deliver revert.\n   * @param _input ABI-encoded `SwapExactOutParams`.\n   */\n  // slither-disable-start reentrancy-balance\n  function _v2SwapExactOut(bytes calldata _input) internal {\n    SwapExactOutParams memory _params = abi.decode(_input, (SwapExactOutParams));\n\n    (address[] memory _tokens, bool[] memory _zeroForOne) =\n      _checkAndResolveRoute(_params.pools, _params.tokenIn, false, _params.recipient);\n    uint256 _length = _params.pools.length;\n    address _tokenOut = _tokens[_length];\n\n    // If the final recipient is the Metarouter, track the output token.\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_tokenOut);\n\n    // Quote each hop's required input backwards from the exact output.\n    uint256[] memory _amounts = new uint256[](_length + 1);\n    _amounts[_length] = _params.amountOut;\n    for (uint256 _i = _length; _i > 0;) {\n      --_i;\n      // The pool quotes the exact input its curve and total fee require for this hop's output.\n      _amounts[_i] = IPool(_params.pools[_i]).getAmountInWithTotalFee(_amounts[_i + 1], _tokens[_i + 1]);\n    }\n\n    // Reverts if the route requires more input than the authorized maximum.\n    if (_amounts[0] > _params.maxAmountIn) revert TooMuchRequested();\n\n    // The payer sends the quoted input straight to the first pool.\n    address _payer = _params.payerIsUser ? MetarouterState.msgSender() : address(this);\n    // Track custody-funded inputs so any unspent residual is swept back at batch closure.\n    if (!_params.payerIsUser) MetarouterState.trackERC20(_params.tokenIn);\n    FundsLib.pay(_params.tokenIn, _payer, _params.pools[0], _amounts[0]);\n\n    uint256 _balanceBefore = 0;\n\n    // Execute the swaps route.\n    for (uint256 _i; _i < _length; ++_i) {\n      // Route intermediate output to the next pool and final output to the recipient after snapshotting its balance.\n      address _recipient;\n      if (_i + 1 < _length) {\n        _recipient = _params.pools[_i + 1];\n      } else {\n        _recipient = _params.recipient;\n        // Snapshot immediately before the final swap so earlier route inflows cannot inflate the received amount.\n        _balanceBefore = IERC20(_tokenOut).balanceOf(_recipient);\n      }\n      _v2Swap(_params.pools[_i], _zeroForOne[_i], _amounts[_i + 1], _recipient);\n    }\n\n    // Reverts if the recipient did not receive the exact requested output.\n    uint256 _received = IERC20(_tokenOut).balanceOf(_params.recipient) - _balanceBefore;\n    if (_received < _params.amountOut) revert TooLittleReceived(_params.amountOut, _received);\n  }\n\n  // slither-disable-end reentrancy-balance\n\n  /**\n   * @notice Executes a V2 pool swap using the precomputed output amount.\n   * @param _pool Pool to execute against.\n   * @param _zeroForOne Whether token0 is exchanged for token1.\n   * @param _amountOut Output amount requested from the pool.\n   * @param _recipient Address that receives the output.\n   */\n  function _v2Swap(address _pool, bool _zeroForOne, uint256 _amountOut, address _recipient) internal {\n    (uint256 _amount0Out, uint256 _amount1Out) = _zeroForOne ? (uint256(0), _amountOut) : (_amountOut, uint256(0));\n    IPool(_pool).swap(_amount0Out, _amount1Out, _recipient, '');\n  }\n\n  /**\n   * @notice Executes a CL pool swap with the pool authorized as the only callback caller.\n   * @dev Arms the callback slot for the pool, swaps, and requires the pool to have consumed the authorization by\n   *      paying through the callback.\n   * @param _pool Pool to execute against.\n   * @param _zeroForOne Whether token0 is exchanged for token1.\n   * @param _amountSpecified Exact input amount, or negated exact output amount.\n   * @param _recipient Address that receives the output.\n   * @param _data Callback payment authorization forwarded to the pool.\n   * @return _amount0 Signed token0 balance change of the pool.\n   * @return _amount1 Signed token1 balance change of the pool.\n   */\n  function _clSwap(\n    address _pool,\n    bool _zeroForOne,\n    int256 _amountSpecified,\n    address _recipient,\n    bytes memory _data\n  ) internal returns (int256 _amount0, int256 _amount1) {\n    // Check the callback caller slot is empty, and then set the pool as the only accepted one.\n    address _current = address(uint160(TransientTracking.load(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT)));\n    if (_current != address(0)) revert CallbackNotCleared(_current);\n    TransientTracking.store(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT, uint256(uint160(_pool)));\n\n    // Selling token0 moves the price down and selling token1 up, so the boundary acts as no price limit at this point.\n    uint160 _sqrtRatioX96 = _zeroForOne ? _MIN_SQRT_RATIO_PLUS_ONE : _MAX_SQRT_RATIO_MINUS_ONE;\n    // Execute the swap.\n    (_amount0, _amount1) = ICLPool(_pool).swap(_recipient, _zeroForOne, _amountSpecified, _sqrtRatioX96, _data);\n\n    // The pool must consume its authorization by paying through the callback.\n    if (TransientTracking.load(MetarouterState.EXPECTED_CALLBACK_CALLER_SLOT) != 0) revert CallbackNotCleared(_pool);\n  }\n\n  // ============================== Control Flow ==============================\n\n  /**\n   * @notice Runs a nested command list in a call frame whose failure can be caught.\n   * @param _input ABI-encoded sub-plan commands and inputs.\n   */\n  function _executeSubPlan(bytes calldata _input) internal virtual {\n    (bytes memory _subCommands, bytes[] memory _subInputs) = abi.decode(_input, (bytes, bytes[]));\n    try this.execute(_subCommands, _subInputs, type(uint256).max) {}\n    catch (bytes memory _output) {\n      _revert(_output);\n    }\n  }\n\n  /**\n   * @notice Checks a forward-ordered pool route and its recipient, and resolves its token sequence and directions.\n   * @param _pools Pools in the route.\n   * @param _tokenIn Input token for the first pool.\n   * @param _clRoute Whether the route must consist of CL pools instead of V2 pools.\n   * @param _recipient Address that receives the route's final output.\n   * @return _tokens Route tokens, including the initial input and final output tokens.\n   * @return _zeroForOne Whether token0 is exchanged for token1 for each pool.\n   */\n  function _checkAndResolveRoute(\n    address[] memory _pools,\n    address _tokenIn,\n    bool _clRoute,\n    address _recipient\n  ) internal view returns (address[] memory _tokens, bool[] memory _zeroForOne) {\n    if (_recipient == address(0)) revert InvalidRecipient();\n    uint256 _length = _pools.length;\n    if (_length == 0) revert InvalidPath();\n    _tokens = new address[](_length + 1);\n    _zeroForOne = new bool[](_length);\n    _tokens[0] = _tokenIn;\n\n    for (uint256 _i; _i < _length; ++_i) {\n      address _pool = _pools[_i];\n      // Resolve the permanent creation record so existing pools remain usable if their factory is later unapproved.\n      address _factory = FACTORY_REGISTRY.targetToFactory(_pool);\n      if (_factory == address(0)) revert InvalidPool(_pool);\n      if (!IPoolFactory(_factory).isPool(_pool)) revert InvalidPool(_pool);\n      // V2 and CL pool interfaces share the same POOL_TYPE() getter signature and return type.\n      bytes32 _poolType = IPool(_pool).POOL_TYPE();\n      // Reject any pool outside the route's family.\n      if (_clRoute) {\n        if (_poolType != _CL_POOL_TYPE) revert InvalidPool(_pool);\n      } else if (_poolType != _V2_VOLATILE_POOL_TYPE && _poolType != _V2_STABLE_POOL_TYPE) {\n        revert InvalidPool(_pool);\n      }\n\n      // Check which one of token0 or token1 is the input token.\n      (address _token0, address _token1) = (IPool(_pool).token0(), IPool(_pool).token1());\n      bool _isZeroForOne = _tokens[_i] == _token0;\n      if (!_isZeroForOne && _tokens[_i] != _token1) revert InvalidPath();\n      _zeroForOne[_i] = _isZeroForOne;\n\n      // Derive this hop's output token, which becomes the next hop's input.\n      _tokens[_i + 1] = _isZeroForOne ? _token1 : _token0;\n    }\n  }\n\n  /**\n   * @notice Rejects delegatecalls: the router re-enters itself by address, so it must run at its deployment address.\n   * @dev Sub-plans and allow-revert commands re-enter via `address(this).call(execute)`. Under a delegatecall\n   *      `address(this)` is not Metarouter, which implies `execute()` may not be available, so an allow-revert\n   *      command would silently no-op. Fail fast instead.\n   */\n  function _checkExecutionContext() internal view virtual {\n    if (address(this) != _IMPLEMENTATION) revert DirectCallRequired();\n  }\n\n  /**\n   * @notice Balance assertion whose failure can be handled with ALLOW_REVERT.\n   * @dev Address zero selects native ETH. For the execution address, a balance means only what is available to the\n   *      active batch: native ETH excludes what was held before the batch began, and the native ERC20 — whose\n   *      `balanceOf` is the native balance — applies the same exclusion. Other owners use their live account balance.\n   * @param _input ABI-encoded asset, owner, and minimum balance.\n   */\n  function _balanceCheck(bytes calldata _input) internal view virtual {\n    (address _asset, address _owner, uint256 _minBalance) = abi.decode(_input, (address, address, uint256));\n    uint256 _balance;\n    if (_asset == address(0)) {\n      _balance = _owner == address(this) ? MetarouterState.availableNativeBalance() : _owner.balance;\n    } else {\n      _balance =\n        _owner == address(this) ? MetarouterState.availableErc20Balance(_asset) : IERC20(_asset).balanceOf(_owner);\n    }\n    if (_balance < _minBalance) revert InsufficientBalance(_asset);\n  }\n\n  /**\n   * @notice Splits a command byte into its command ID and allow-revert flag.\n   * @param _commandByte Encoded command ID and flags.\n   * @return _commandType Command ID with flags removed.\n   * @return _allowRevert Whether failure of the command may be ignored.\n   */\n  function _decode(bytes1 _commandByte) internal pure virtual returns (uint256 _commandType, bool _allowRevert) {\n    _commandType = uint256(uint8(_commandByte & Commands.COMMAND_TYPE_MASK));\n    _allowRevert = _commandByte & Commands.FLAG_ALLOW_REVERT != 0;\n  }\n\n  /**\n   * @notice Bubbles revert data returned by a failed child frame.\n   * @param _output Raw revert data to re-throw.\n   */\n  function _revert(bytes memory _output) private pure {\n    assembly ('memory-safe') {\n      revert(add(_output, 0x20), mload(_output))\n    }\n  }\n}\n"},"V3/src/interfaces/core/IVotes.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @notice Modified votes interface for token ID based voting.\ninterface IVotes {\n  /// @notice Emitted when an account changes its delegate.\n  event DelegateChanged(address indexed _delegator, uint256 indexed _fromDelegate, uint256 indexed _toDelegate);\n\n  /// @notice Emitted when a transfer or delegation changes a delegate's voting power.\n  event DelegateVotesChanged(address indexed _delegate, uint256 _previousBalance, uint256 _newBalance);\n\n  /// @notice Delegates a token ID's votes to another token ID.\n  function delegate(uint256 _delegator, uint256 _delegatee) external;\n\n  /// @notice Delegates votes using an owner signature.\n  function delegateBySig(\n    uint256 _delegator,\n    uint256 _delegatee,\n    uint256 _nonce,\n    uint256 _expiry,\n    uint8 _v,\n    bytes32 _r,\n    bytes32 _s\n  ) external;\n\n  /// @notice Returns the votes a token ID had at a past timepoint for its owner.\n  function getPastVotes(address _account, uint256 _tokenId, uint256 _timepoint) external view returns (uint256);\n\n  /// @notice Returns the total voting power at a past timepoint.\n  function getPastTotalSupply(uint256 _timepoint) external view returns (uint256);\n\n  /// @notice Returns the delegate selected by a token ID.\n  function delegates(uint256 _tokenId) external view returns (uint256);\n}\n"},"V3/src/interfaces/pools/IPool.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IPool\n * @notice Interface for the Pool contract, the abstract base shared by the Aerodrome V2 volatile and stable pools\n */\ninterface IPool {\n  /*////////////////////////////////////////////////////////////\n                            EVENTS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Emitted when fees are claimed by a liquidity provider\n  /// @param sender Address that triggered the fee claim\n  /// @param amount0 Amount of token0 fees collected\n  /// @param amount1 Amount of token1 fees collected\n  event Fees(address indexed sender, uint256 amount0, uint256 amount1);\n  /// @notice Emitted when liquidity is minted\n  /// @param sender Address that initiated the mint\n  /// @param to Address that received the LP tokens\n  /// @param amount0 Amount of token0 deposited\n  /// @param amount1 Amount of token1 deposited\n  event Mint(address indexed sender, address indexed to, uint256 amount0, uint256 amount1);\n  /// @notice Emitted when liquidity is burned\n  /// @param sender Address that initiated the burn\n  /// @param to Address that received the underlying tokens\n  /// @param amount0 Amount of token0 returned\n  /// @param amount1 Amount of token1 returned\n  event Burn(address indexed sender, address indexed to, uint256 amount0, uint256 amount1);\n  /// @notice Emitted on every swap executed through the pool\n  /// @param sender Address that initiated the swap\n  /// @param to Address that received the output tokens\n  /// @param amount0In Amount of token0 provided as input\n  /// @param amount1In Amount of token1 provided as input\n  /// @param amount0Out Amount of token0 sent as output\n  /// @param amount1Out Amount of token1 sent as output\n  event Swap(\n    address indexed sender,\n    address indexed to,\n    uint256 amount0In,\n    uint256 amount1In,\n    uint256 amount0Out,\n    uint256 amount1Out\n  );\n  /// @notice Emitted when reserves are synced to the current balances\n  /// @param reserve0 Updated reserve of token0\n  /// @param reserve1 Updated reserve of token1\n  event Sync(uint256 reserve0, uint256 reserve1);\n\n  /// @notice Emitted when accumulated fee tokens are claimed\n  /// @param caller Address that triggered the claim\n  /// @param account Address whose accumulated fees were claimed\n  /// @param recipient Address that received the fee tokens\n  /// @param amount0 Amount of token0 claimed\n  /// @param amount1 Amount of token1 claimed\n  event Claim(\n    address indexed caller, address indexed account, address indexed recipient, uint256 amount0, uint256 amount1\n  );\n  /// @notice Emitted when an account grants or revokes claim approval for an operator\n  /// @param account Account whose approval state changed\n  /// @param operator Operator being approved or revoked\n  /// @param approved New approval state\n  event ClaimApproval(address indexed account, address indexed operator, bool approved);\n  /// @notice Emitted whenever `observationCardinalityNext` is increased\n  /// @param caller Address that triggered the cardinality growth\n  /// @param observationCardinalityNextOld Previous value of `observationCardinalityNext`\n  /// @param observationCardinalityNextNew New value of `observationCardinalityNext`\n  event IncreaseObservationCardinalityNext(\n    address indexed caller, uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew\n  );\n\n  /*////////////////////////////////////////////////////////////\n                            ERRORS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when the factory address has already been set and cannot be changed\n  error FactoryAlreadySet();\n  /// @notice Thrown when the input amount provided to a swap is zero or insufficient\n  error InsufficientInputAmount();\n  /// @notice Thrown when the pool does not have enough liquidity to fulfil the operation\n  error InsufficientLiquidity();\n  /// @notice Thrown when burning LP tokens would return zero of at least one underlying token\n  error InsufficientLiquidityBurned();\n  /// @notice Thrown when minting would produce zero LP tokens\n  error InsufficientLiquidityMinted();\n  /// @notice Thrown when the output amount of a swap is zero or below the requested minimum\n  error InsufficientOutputAmount();\n  /// @notice Thrown when the `to` address supplied to swap or burn is one of the pool's tokens\n  error InvalidTo();\n  /// @notice Thrown when an operation is attempted while the pool is paused\n  error IsPaused();\n  /// @notice Thrown when the invariant K check fails after a swap\n  error K();\n  /// @notice Thrown when the caller is neither the account nor an approved claim operator\n  error NotAuthorized();\n  /// @notice Thrown when a zero address is supplied where a non-zero address is required\n  error ZeroAddress();\n  /*////////////////////////////////////////////////////////////\n                        EXTERNAL FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Grants or revokes an operator's permission to claim the caller's accumulated fees\n  /// @param _operator Operator whose approval is updated\n  /// @param _approved Whether the operator is approved\n  function approveForClaim(address _operator, bool _approved) external;\n\n  /// @notice Claims the caller's accumulated fees\n  /// @param _recipient Address that receives the claimed fee tokens\n  /// @return _amount0 Amount of token0 claimed\n  /// @return _amount1 Amount of token1 claimed\n  function claimFees(address _recipient) external returns (uint256 _amount0, uint256 _amount1);\n\n  /// @notice Claims an account's accumulated fees\n  /// @dev The caller must be `_account` or an operator approved by `_account`\n  /// @param _account Account whose accumulated fees are claimed\n  /// @param _recipient Address that receives the claimed fee tokens\n  /// @return _amount0 Amount of token0 claimed\n  /// @return _amount1 Amount of token1 claimed\n  function claimFees(address _account, address _recipient) external returns (uint256 _amount0, uint256 _amount1);\n\n  /// @notice Returns the value of K in the Pool, based on its reserves.\n  function getK() external returns (uint256);\n\n  /// @notice Set pool name\n  ///         Only callable by IPoolFactory(factory).poolAdmin()\n  /// @param __name String of new name\n  function setName(string calldata __name) external;\n\n  /// @notice Set pool symbol\n  ///         Only callable by IPoolFactory(factory).poolAdmin()\n  /// @param __symbol String of new symbol\n  function setSymbol(string calldata __symbol) external;\n\n  /// @notice This low-level function should be called from a contract which performs important safety checks\n  /// @param amount0Out Amount of token0 to send to `to`\n  /// @param amount1Out Amount of token1 to send to `to`\n  /// @param to Address to recieve the swapped output\n  /// @param data Additional calldata for flashloans\n  function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n\n  /// @notice This low-level function should be called from a contract which performs important safety checks\n  ///         standard uniswap v2 implementation\n  /// @param to Address to receive token0 and token1 from burning the pool token\n  /// @return amount0 Amount of token0 returned\n  /// @return amount1 Amount of token1 returned\n  function burn(address to) external returns (uint256 amount0, uint256 amount1);\n\n  /// @notice This low-level function should be called by addLiquidity functions in Router.sol, which performs important safety checks\n  ///         standard uniswap v2 implementation\n  /// @param to Address to receive the minted LP token\n  /// @return liquidity Amount of LP token minted\n  function mint(address to) external returns (uint256 liquidity);\n\n  /// @notice Force balances to match reserves\n  /// @param to Address to receive any skimmed rewards\n  function skim(address to) external;\n\n  /// @notice Force reserves to match balances\n  function sync() external;\n\n  /// @notice Called on pool creation by the owning PoolFactory\n  /// @param _token0 Address of token0\n  /// @param _token1 Address of token1\n  function initialize(address _token0, address _token1) external;\n\n  /// @notice Pre-allocates buffer slots increasing the buffer capacity\n  /// @param _observationCardinalityNext New target capacity. At most 65,535.\n  function increaseObservationCardinalityNext(uint16 _observationCardinalityNext) external;\n\n  /*////////////////////////////////////////////////////////////\n                      PURE AND VIEW FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Returns the decimal (dec), reserves (r), and tokens (t) of token0 and token1\n  function metadata() external view returns (uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, address t0, address t1);\n\n  /// @notice Returns [token0, token1]\n  function tokens() external view returns (address, address);\n\n  /// @notice Returns accumulated but unclaimed fees for an account.\n  /// @param _account Address to query.\n  /// @return _amount0 Pending token0 fees.\n  /// @return _amount1 Pending token1 fees.\n  function pendingFees(address _account) external view returns (uint256 _amount0, uint256 _amount1);\n\n  /// @notice Address of token in the pool with the lower address value\n  function token0() external view returns (address);\n\n  /// @notice Address of token in the pool with the higher address value\n  function token1() external view returns (address);\n\n  /// @notice Address of linked PoolFees.sol\n  function poolFees() external view returns (address);\n\n  /// @notice Address of PoolFactory that created this contract\n  function factory() external view returns (address);\n\n  /// @notice Period gate for new observations, in seconds. A new observation is written when more\n  ///         than `PERIOD_SIZE` seconds have passed since the last one, so the smallest possible\n  ///         spacing between two stored observations is `PERIOD_SIZE + 1` (i.e. 61 seconds at the\n  ///         default value of 60).\n  function PERIOD_SIZE() external view returns (uint256);\n\n  /// @notice The pool type identifier\n  /// @return The pool type label to be able to identify the type of pool\n  function POOL_TYPE() external view returns (bytes32);\n\n  /// @notice Amount of token0 in pool\n  function reserve0() external view returns (uint256);\n\n  /// @notice Amount of token1 in pool\n  function reserve1() external view returns (uint256);\n\n  /// @notice Timestamp of last update to pool\n  function blockTimestampLast() external view returns (uint256);\n\n  /// @notice Cumulative of reserve0 factoring in time elapsed\n  function reserve0CumulativeLast() external view returns (uint256);\n\n  /// @notice Cumulative of reserve1 factoring in time elapsed\n  function reserve1CumulativeLast() external view returns (uint256);\n\n  /// @notice Accumulated fees of token0 (global)\n  function index0() external view returns (uint256);\n\n  /// @notice Accumulated fees of token1 (global)\n  function index1() external view returns (uint256);\n\n  /// @notice Get an LP's relative index0 to index0\n  function supplyIndex0(address) external view returns (uint256);\n\n  /// @notice Get an LP's relative index1 to index1\n  function supplyIndex1(address) external view returns (uint256);\n\n  /// @notice Amount of unclaimed, but claimable tokens from fees of token0 for an LP\n  function claimable0(address) external view returns (uint256);\n\n  /// @notice Amount of unclaimed, but claimable tokens from fees of token1 for an LP\n  function claimable1(address) external view returns (uint256);\n\n  /// @notice Whether an operator may claim an account's accumulated fees\n  /// @param _account Account that owns the accumulated fees\n  /// @param _operator Operator whose approval is queried\n  /// @return _approved Whether the operator is approved\n  function approvedForClaim(address _account, address _operator) external view returns (bool _approved);\n\n  /// @notice Produces the cumulative price using counterfactuals to save gas and avoid a call to sync.\n  function currentCumulativePrices()\n    external\n    view\n    returns (uint256 reserve0Cumulative, uint256 reserve1Cumulative, uint256 blockTimestamp);\n\n  /// @notice Update reserves and, on the first call per block, price accumulators\n  /// @return _reserve0 .\n  /// @return _reserve1 .\n  /// @return _blockTimestampLast .\n  function getReserves() external view returns (uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast);\n\n  /// @notice Get the amount of tokenOut given the amount of tokenIn, charging only the base fee\n  /// @dev Does not charge the MEV tax, so the result can be higher than what `swap` pays out.\n  ///      Use `getAmountOutWithTotalFee` to quote a swap.\n  /// @param amountIn Amount of token in\n  /// @param tokenIn Address of token\n  /// @return Amount out\n  function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256);\n\n  /// @notice Get the amount of tokenOut given the amount of tokenIn, charging the total fees\n  /// @param amountIn Amount of token in\n  /// @param tokenIn Address of token in\n  /// @return Amount out\n  function getAmountOutWithTotalFee(uint256 amountIn, address tokenIn) external view returns (uint256);\n\n  /// @notice Get the amount of tokenIn required to receive the amount of tokenOut, charging the total fees\n  /// @dev Reverts if the exact output cannot be calculated\n  /// @param amountOut Amount of token out to receive\n  /// @param tokenOut Address of token out\n  /// @return Amount in, fee included\n  function getAmountInWithTotalFee(uint256 amountOut, address tokenOut) external view returns (uint256);\n\n  /// @notice Returns the cumulative reserves as of each requested `secondsAgo`. Reverts when any\n  ///         `secondsAgos[i]` predates the oldest stored observation.\n  /// @dev Offsets between two stored observations are linearly interpolated. Observations are\n  ///      period-gated, so reserve changes within an interval may go unrecorded, making the\n  ///      interpolation an approximation. Read from the pool directly when an exact value is required.\n  /// @dev A point newer than the newest stored observation is estimated from the current cumulative\n  ///      instead of two stored ones, so a trade after that point can change what it reads. It stops\n  ///      changing once an observation is stored at or after that point. Points that already fall\n  ///      between two stored observations read the same on every call.\n  /// @param secondsAgos Array of seconds offsets from `block.timestamp` to query\n  /// @return reserve0Cumulatives Cumulative reserve0 values at each requested point\n  /// @return reserve1Cumulatives Cumulative reserve1 values at each requested point\n  function observe(uint32[] calldata secondsAgos)\n    external\n    view\n    returns (uint256[] memory reserve0Cumulatives, uint256[] memory reserve1Cumulatives);\n\n  /// @notice Quote `amountIn` of `tokenIn` against a custom reserve snapshot\n  /// @dev Subtracts the base fee from `amountIn` before applying the curve. Does not charge the MEV\n  ///      tax, so use `getAmountOutWithTotalFee` to quote a swap.\n  /// @param amountIn Input amount in the smallest unit of `tokenIn`\n  /// @param tokenIn Address of the input token\n  /// @param _reserve0 Reserve of token0 to quote against\n  /// @param _reserve1 Reserve of token1 to quote against\n  /// @return Output amount the swap would produce against the supplied reserves\n  function getAmountOut(\n    uint256 amountIn,\n    address tokenIn,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256);\n\n  /// @notice TWAP circular buffer metadata\n  /// @return index Index of the most recent observation in the buffer\n  /// @return cardinality Number of populated slots in the buffer\n  /// @return cardinalityNext Number of slots that can be written\n  function observationBuffer() external view returns (uint16 index, uint16 cardinality, uint16 cardinalityNext);\n\n  /// @notice Returns the observation at the given index\n  /// @param index Index of the observation to return\n  /// @return timestamp Timestamp of the observation\n  /// @return reserve0Cumulative Cumulative reserve0 of the observation\n  /// @return reserve1Cumulative Cumulative reserve1 of the observation\n  function observations(uint256 index)\n    external\n    view\n    returns (uint32 timestamp, uint256 reserve0Cumulative, uint256 reserve1Cumulative);\n}\n"},"V3/src/interfaces/relay/IRelay.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IGovernor} from 'V3/interfaces/governor/IGovernor.sol';\nimport {IRelayToken} from 'V3/interfaces/relay/IRelayToken.sol';\nimport {IRelayVoteAdapter} from 'V3/interfaces/relay/IRelayVoteAdapter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\nimport {IVoterPaymentsModule} from 'V3/interfaces/vpm/IVoterPaymentsModule.sol';\n\n/**\n * @title  IRelay\n * @notice The base Relay surface: types, events, errors and every external member of RelayBase.\n *         Tier-specific members live on the concrete subclasses.\n */\ninterface IRelay {\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                      ENUMS                                         __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice The Relay tier, set at deployment; it decides the access model and the reward-processing flexibility.\n  /// @dev Maxi: permissionless deposits.\n  ///      ProtocolL1: whitelist-gated, fixed entrypoints.\n  ///      ProtocolL2: whitelist-gated, mutable entrypoints, sweep.\n  enum RelayType {\n    Maxi,\n    ProtocolL1,\n    ProtocolL2\n  }\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                     STRUCTS                                        __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Relay-level configuration, set at initialization.\n  /// @param tokenId The Relay's own sAERO that aggregates all pooled weight.\n  /// @param minDeposit Minimum requestable deposit (dust guard).\n  /// @param keeperWindow Time the keeper has to process a deposit before it becomes processable permissionlessly.\n  /// @param minWithdrawal Minimum shares per withdraw registration (dust guard). A partial exit must also\n  ///        leave at least this many free shares behind. The whole free position may always leave in one go.\n  /// @param entrypointTimelock Exit-window delay (seconds) of every timelocked change: an L2 entrypoint\n  ///        attachment, a leaf recipient, an operator, an ICA module keeper or leaf config and a rake raise; non-zero.\n  /// @param lockWeeks Lock horizon in weeks re-extended on each allocation; zero means a permanent stake.\n  /// @param evacuationWindow Seconds a queued withdrawal may wait unpaid (from its registration) before anyone may\n  ///        permanently close the Relay and start the evacuation. Fixed at creation, non-zero.\n  /// @param name Relay display name, also the stem of the satellite-token names at creation;\n  ///        mutable via `setName`.\n  /// @param symbol Stem of the satellite-token symbols; no setter.\n  /// @dev `minDeposit` is held to `MIN_STAKE_AMOUNT`, the same bar the seed stake clears.\n  ///      `minWithdrawal` only has to be non-zero.\n  struct RelayConfig {\n    uint256 tokenId;\n    uint256 minDeposit;\n    uint256 keeperWindow;\n    uint256 minWithdrawal;\n    uint256 entrypointTimelock;\n    uint48 lockWeeks;\n    uint48 evacuationWindow;\n    string name;\n    string symbol;\n  }\n\n  /// @notice Initialization inputs for a freshly cloned Relay. The factory names `vpm`, `governor`\n  ///         and `voteAdapter` from its own immutables, never the creator.\n  /// @param admin Initial owner: it holds the admin gates and manages every role bit.\n  /// @param keeper Initial KEEPER, granted the role.\n  /// @param voter Initial VOTER_ROLE operator, or zero to skip; rotatable by the owner afterwards.\n  /// @param compounder Entrypoint granted COMPOUNDER, or zero to skip; immutable on Maxi/L1.\n  ///        Naming neither entrypoint is rejected unless the Relay starts as L2, which attaches later.\n  /// @param converter Entrypoint granted CONVERTER, or zero to skip; immutable on Maxi/L1.\n  /// @param bootstrapOwner Non-zero recipient of the bootstrap principal minted 1:1 against the seed stake. The\n  ///        seed has no yield side, so it exits only once the Relay is closed. Use a dedicated address: a deposit\n  ///        from it while the Relay is open can sit below the exit floor until a top-up or closure.\n  /// @param rewardToken First reward token to register, or zero to leave the registry empty for KEEPER.\n  ///        Naming it here pins it in the same call that names the entrypoints it must match.\n  /// @param entrypointVetoer Holder of ENTRYPOINT_VETOER, or zero to run the timelock without a veto.\n  ///        Only seatable here: the public role paths refuse the bit, so an empty seat can never be\n  ///        filled later. Only the Protocol tier reads it.\n  /// @param rakeManagerAdmin Non-zero holder of RAKE_MANAGER_ADMIN.\n  /// @param protocolRakePips Genesis protocol rake, at most `MAX_RAKE_PIPS`.\n  /// @param allocatorRakePips Genesis allocator rake, at most `MAX_RAKE_PIPS`.\n  /// @param vpm Non-zero VoterPaymentsModule the Relay starts on.\n  /// @param governor Non-zero Governor the Relay starts casting into; movable through `setGovernor`.\n  /// @param voteAdapter Non-zero adapter every cast is encoded by; movable through `setGovernor`.\n  /// @param startAsLevel2 True to start a Protocol Relay directly as L2; tiers without an L2 path reject it.\n  /// @param ytTransferable True to deploy the yield token transferable; false makes it soulbound.\n  ///        Immutable switch on the YT clone; tiers with an allow list reject true.\n  /// @param config Relay configuration; the factory stamps `tokenId` and `lockWeeks` from the seed stake.\n  struct InitParams {\n    address admin;\n    address keeper;\n    address voter;\n    address compounder;\n    address converter;\n    address bootstrapOwner;\n    address rewardToken;\n    address entrypointVetoer;\n    address rakeManagerAdmin;\n    uint256 protocolRakePips;\n    uint256 allocatorRakePips;\n    IVoterPaymentsModule vpm;\n    IGovernor governor;\n    IRelayVoteAdapter voteAdapter;\n    bool startAsLevel2;\n    bool ytTransferable;\n    RelayConfig config;\n  }\n\n  /// @notice One entry of the deposit queue: a queued async deposit that waits for processing.\n  ///         Processing deletes the entry, which refunds its storage and marks the id consumed.\n  /// @param recipient Address the shares mint to, named at request.\n  /// @param requestedAt Request timestamp; after `keeperWindow` anyone can process the entry. Zero\n  ///        marks a consumed entry, because a live one always stamps its request's block timestamp.\n  /// @param tokenId Depositing sAERO the weight came from; only the `DepositProcessed` event reads it.\n  /// @param amount Staking weight moved into the Relay sAERO and held on chain0.\n  /// @dev The queue stores no link to the next entry. Ids run in sequence from one and are never\n  ///      reused, so every id up to `tail` was issued and the next id is always this id plus one.\n  ///      Deleting a consumed entry keeps that derivation intact — the id holds its place in the\n  ///      walk order — but a path that reused an id would break it and must store an explicit link.\n  struct PendingDeposit {\n    address recipient;\n    uint48 requestedAt;\n    uint128 tokenId;\n    uint128 amount;\n  }\n\n  /// @notice A reserved exit sitting in the FIFO withdraw queue until the drain settles it.\n  /// @param holder Owner of the escrowed shares, credited the weight on drain.\n  /// @param registeredAt Registration timestamp, stamped once and never moved; anchors the\n  ///        evacuation clock when the entry reaches the head of the queue.\n  /// @param mintFresh Whether the drain routes the weight to a freshly minted sAERO.\n  /// @param shares Shares the holder locked in place (non-transferable), burned when the entry settles.\n  /// @param destination Destination sAERO the weight returns to, zero when `mintFresh` is set.\n  /// @dev Packs into two slots. `MINT_SENTINEL` lives only at the API boundary, because a sentinel\n  ///      inside `destination`'s 72-bit range would collide with a real token id: registration\n  ///      folds it into `mintFresh`, and the `withdrawals` getter and the events rebuild it.\n  struct WithdrawEntry {\n    address holder;\n    uint48 registeredAt;\n    bool mintFresh;\n    uint128 shares;\n    uint72 destination;\n  }\n\n  /// @notice A proposed leaf claim recipient waiting out its timelock.\n  /// @param recipient Address the claims for the chain would move to.\n  /// @param proposedAt Timestamp the proposal was stamped; the delay runs from here.\n  struct PendingRecipient {\n    address recipient;\n    uint48 proposedAt;\n  }\n\n  /// @notice A proposed leaf operator waiting out its timelock.\n  /// @param operator Address that would be named operator of the Relay's sAERO on the chain.\n  /// @param proposedAt Timestamp the proposal was stamped; the delay runs from here.\n  struct PendingOperator {\n    address operator;\n    uint48 proposedAt;\n  }\n\n  /// @notice One ERC-20 leg of a sweep, moved from the Relay's own balance on root (root-only, no\n  ///         cross-chain dispatch).\n  /// @param token Token to sweep, held by the Relay on root.\n  /// @param recipient Destination of the swept tokens.\n  /// @param amount Amount to move.\n  struct ERC20Sweep {\n    address token;\n    address recipient;\n    uint256 amount;\n  }\n\n  /// @notice The rake rates and the pending rate change.\n  /// @param protocolPips Protocol rake, in pips of the yield batch.\n  /// @param allocatorPips Allocator rake, in pips of the batch left after the protocol rake.\n  /// @param pendingProtocolPips Proposed protocol rake.\n  /// @param pendingAllocatorPips Proposed allocator rake.\n  /// @param executableAt Timestamp from which the proposed pair can be executed; zero when none is pending.\n  struct RakeState {\n    uint24 protocolPips;\n    uint24 allocatorPips;\n    uint24 pendingProtocolPips;\n    uint24 pendingAllocatorPips;\n    uint48 executableAt;\n  }\n\n  /// @notice Rake accrued in one token and not yet collected.\n  /// @param protocol Protocol lane, collected to the factory's rake treasury.\n  /// @param allocator Allocator lane, collected by VOTER_ROLE.\n  struct FeeAccrual {\n    uint128 protocol;\n    uint128 allocator;\n  }\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                      EVENTS                                        __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Emitted when the owner adds or removes an address from the allow list gating deposits and\n  ///         holder-to-holder yield-token transfers (both ends must be listed).\n  /// @param account Address whose permission changed.\n  /// @param allowed True when permitted, false when revoked.\n  event AllowListSet(address indexed account, bool allowed);\n\n  /// @notice Emitted when the owner hard-kicks an account: de-listed, and its free position forced\n  ///         into the withdraw queue.\n  /// @param account Account that was kicked.\n  /// @param shares Free shares forced into the withdraw queue (zero when it held none).\n  event Kicked(address indexed account, uint256 shares);\n\n  /// @notice Emitted on the one-way promotion of a Protocol L1 Relay to Protocol L2.\n  /// @param admin Address the ownership moved to at promotion.\n  event PromotedToLevel2(address indexed admin);\n\n  /// @notice Emitted when the owner proposes attaching an entrypoint on an L2 Relay.\n  /// @param role Entrypoint role proposed (COMPOUNDER or CONVERTER).\n  /// @param account Entrypoint address proposed for the role.\n  /// @param executableAt Timestamp from which the proposal may be executed (`now + entrypointTimelock`).\n  event EntrypointProposed(uint256 indexed role, address indexed account, uint256 executableAt);\n\n  /// @notice Emitted when ENTRYPOINT_VETOER cancels a pending entrypoint proposal.\n  /// @param role Entrypoint role the cancelled proposal targeted.\n  /// @param account Entrypoint address the cancelled proposal targeted.\n  event EntrypointVetoed(uint256 indexed role, address indexed account);\n\n  /// @notice Emitted on every successful allocation cast against the Voter.\n  /// @param caller Holder of VOTER_ROLE that sent the allocation.\n  event Allocated(address indexed caller);\n\n  /// @notice Emitted when the Relay is permanently closed.\n  /// @param caller Address that closed the Relay (anyone once a withdrawal has waited the full window unpaid,\n  ///        the owner at will).\n  event Closed(address indexed caller);\n\n  /// @notice Emitted when an evacuation dispatches one chain's full pull-out on a closed Relay.\n  ///         Fires again on every re-dispatch.\n  /// @param caller Address that triggered the evacuation (permissionless once closed).\n  event Evacuated(address indexed caller);\n\n  /// @notice Emitted when an emergency deallocation returns one suspended chain's weight.\n  /// @param chainId Suspended chain whose weight returns.\n  /// @param caller Address that triggered it (KEEPER while open, anyone once closed).\n  event EmergencyDeallocated(uint256 indexed chainId, address indexed caller);\n\n  /// @notice Emitted when a depositor requests an async deposit.\n  /// @param tokenId Depositing sAERO.\n  /// @param recipient Share recipient named at request.\n  /// @param amount Net staking weight received by the Relay sAERO, after the VPM protocol fee.\n  /// @param id Deposit-queue id the entry was appended under, addressing it for individual processing.\n  event DepositRequested(uint256 indexed tokenId, address indexed recipient, uint256 amount, uint256 id);\n\n  /// @notice Emitted when a pending deposit is processed and its shares mint.\n  /// @param tokenId Depositing sAERO.\n  /// @param recipient Share recipient recorded at request.\n  /// @param amount Staking weight admitted into the live backing.\n  /// @param sharesMinted Shares minted at the current ratio.\n  event DepositProcessed(uint256 indexed tokenId, address indexed recipient, uint256 amount, uint256 sharesMinted);\n\n  /// @notice Emitted when a holder reserves an exit on the withdraw queue.\n  /// @param holder Owner of the escrowed shares.\n  /// @param shares Shares escrowed into the queue.\n  /// @param destination Destination sAERO, or the mint sentinel for a fresh one.\n  /// @param id Id the exit was appended under; ids run in sequence from one.\n  event WithdrawRegistered(address indexed holder, uint256 shares, uint256 destination, uint256 id);\n\n  /// @notice Emitted when the drain settles a queued exit.\n  /// @param holder Owner credited the returned weight.\n  /// @param sharesBurnt Escrowed shares burned to settle the exit.\n  /// @param amount Net staking weight received by the destination sAERO, after the VPM protocol fee.\n  /// @param destinationTokenId Destination sAERO that received the weight (freshly minted on fallback).\n  event WithdrawProcessed(address indexed holder, uint256 sharesBurnt, uint256 amount, uint256 destinationTokenId);\n\n  /// @notice Emitted when a reward token is registered in the accumulator registry.\n  /// @param token Reward token added.\n  event RewardTokenAdded(address indexed token);\n\n  /// @notice Emitted when a reward token that never distributed anything leaves the registry.\n  /// @param token Reward token dropped.\n  event RewardTokenRemoved(address indexed token);\n\n  /// @notice Emitted when the Relay moves to another VoterPaymentsModule.\n  /// @param vpm The module every later deposit and withdrawal moves weight through.\n  event VoterPaymentsModuleSet(address indexed vpm);\n\n  /// @notice Emitted when the Relay is pointed at another Governor.\n  /// @param governor The Governor every later `expressVote` casts into.\n  /// @param voteAdapter The adapter translating casts for it.\n  event GovernorSet(address indexed governor, address indexed voteAdapter);\n\n  /// @notice Emitted when the Relay's display name changes.\n  /// @param oldName The name being replaced.\n  /// @param newName The name from here on.\n  event NameChanged(string oldName, string newName);\n\n  /// @notice Emitted when a reward batch advances a token's per-share accumulator.\n  /// @param token Reward token notified.\n  /// @param amount Amount accounted: what the advanced index can pay out, rounded up. The rest of\n  ///        the batch stays un-accounted for the next notify.\n  /// @param newIndex Accumulator index after the batch.\n  event RewardNotified(address indexed token, uint256 amount, uint256 newIndex);\n\n  /// @notice Emitted when a holder claims accrued reward in a token.\n  /// @param holder Holder whose accrual was settled.\n  /// @param token Reward token claimed.\n  /// @param to Recipient of the payout.\n  /// @param amount Amount transferred out.\n  event RewardClaimed(address indexed holder, address indexed token, address indexed to, uint256 amount);\n\n  /// @notice Emitted on every successful compound into the Relay sAERO.\n  /// @param amount TOKEN amount staked into the underlying position.\n  event Compounded(uint256 amount);\n\n  /// @notice Emitted when an entrypoint pulls a token out of the Relay.\n  /// @param entrypoint Entrypoint the token was sent to.\n  /// @param token Token pulled.\n  /// @param amount Amount transferred out.\n  event Pulled(address indexed entrypoint, address indexed token, uint256 amount);\n\n  /// @notice Emitted for each leg of a sweep.\n  /// @param token Token moved.\n  /// @param recipient Recipient the SWEEPER named.\n  /// @param amount Amount transferred out.\n  event TokenSwept(address indexed token, address indexed recipient, uint256 amount);\n\n  /// @notice Emitted once at initialization when the two satellite tokens are cloned and bound.\n  /// @param principalToken The principal token (PT) clone: priced position, withdraw right.\n  /// @param yieldToken The yield token (YT) clone: the balance the reward accumulator reads.\n  event RelayTokensDeployed(address principalToken, address yieldToken);\n\n  /// @notice Emitted when the owner sets (or clears) the recipient that fee/incentive claims for a leaf\n  ///         chain land at on that chain.\n  /// @param chainId Leaf chain the recipient applies to.\n  /// @param recipient Configured claim recipient, or zero when cleared.\n  event LeafRecipientSet(uint256 indexed chainId, address indexed recipient);\n\n  /// @notice Emitted when the owner proposes a new recipient for a leaf chain's fee/incentive claims.\n  /// @param chainId Leaf chain the proposed recipient applies to.\n  /// @param recipient Proposed claim recipient.\n  /// @param executableAt Timestamp from which the proposal may be executed (`now + entrypointTimelock`).\n  event LeafRecipientProposed(uint256 indexed chainId, address indexed recipient, uint256 executableAt);\n\n  /// @notice Emitted when a pending leaf recipient proposal is cancelled.\n  /// @param chainId Leaf chain whose proposal was cancelled.\n  event LeafRecipientProposalCancelled(uint256 indexed chainId);\n\n  /// @notice Emitted when an operator is proposed for a leaf chain.\n  /// @param chainId Leaf chain the operator would act on.\n  /// @param operator Address proposed as operator.\n  /// @param executableAt Timestamp the proposal can be executed at.\n  event OperatorProposed(uint256 indexed chainId, address indexed operator, uint256 executableAt);\n\n  /// @notice Emitted when an operator update is sent to a leaf chain.\n  /// @param chainId Leaf chain the update was sent to.\n  /// @param operator Address named operator; zero clears the seat.\n  /// @dev The leaf applies it when the message arrives, so this records the dispatch and not the\n  ///      landing. A message that expires in transit leaves the leaf on its previous operator.\n  event OperatorDispatched(uint256 indexed chainId, address indexed operator);\n\n  /// @notice Emitted when a pending operator proposal is cancelled.\n  /// @param chainId Leaf chain whose proposal was cancelled.\n  event OperatorProposalCancelled(uint256 indexed chainId);\n\n  /// @notice Emitted when a principal-token holder expresses a preference on a governance proposal\n  ///         and the Relay casts their slice of its weight.\n  /// @param proposalId Proposal the preference applies to.\n  /// @param holder Principal-token holder expressing the preference.\n  /// @param support Support the holder requested: 0 Against, 1 For, 2 Abstain, 255 fractional.\n  /// @param weightUsed Voting weight consumed from the holder's snapshot slice by this call.\n  /// @param params The params the holder supplied (empty for nominal support, three packed `uint128`\n  ///        weights for fractional).\n  event VoteExpressed(\n    uint256 indexed proposalId, address indexed holder, uint8 support, uint256 weightUsed, bytes params\n  );\n\n  /// @notice Emitted when RAKE_MANAGER_ADMIN seats or removes a RAKE_MANAGER.\n  /// @param account Address whose RAKE_MANAGER role changed.\n  /// @param enabled True when seated, false when removed.\n  event RakeManagerSet(address indexed account, bool enabled);\n\n  /// @notice Emitted when the RAKE_MANAGER_ADMIN seat moves.\n  /// @param previousAdmin Address that held the seat.\n  /// @param newAdmin Address that holds the seat now.\n  event RakeManagerAdminTransferred(address indexed previousAdmin, address indexed newAdmin);\n\n  /// @notice Emitted when a rake pair that raises a rate is proposed.\n  /// @param protocolPips Proposed protocol rake.\n  /// @param allocatorPips Proposed allocator rake.\n  /// @param executableAt Timestamp from which the pair can be executed.\n  event RakesProposed(uint256 protocolPips, uint256 allocatorPips, uint256 executableAt);\n\n  /// @notice Emitted when the rake rates change.\n  /// @param protocolPips Protocol rake from here on.\n  /// @param allocatorPips Allocator rake from here on.\n  event RakesSet(uint256 protocolPips, uint256 allocatorPips);\n\n  /// @notice Emitted when a yield batch pays the rake.\n  /// @param token Token of the yield batch.\n  /// @param protocolFee Amount booked to the protocol lane.\n  /// @param allocatorFee Amount booked to the allocator lane.\n  event RakeSkimmed(address indexed token, uint256 protocolFee, uint256 allocatorFee);\n\n  /// @notice Emitted when the protocol lane of a token is collected.\n  /// @param token Token collected.\n  /// @param recipient Rake treasury that received the amount.\n  /// @param amount Amount transferred.\n  event ProtocolFeesCollected(address indexed token, address indexed recipient, uint256 amount);\n\n  /// @notice Emitted when the allocator lane of a token is collected.\n  /// @param token Token collected.\n  /// @param recipient Address that received the amount.\n  /// @param amount Amount transferred.\n  event AllocatorFeesCollected(address indexed token, address indexed recipient, uint256 amount);\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                  CUSTOM ERRORS                                     __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Thrown when the caller is not authorized over the source sAERO through the VPM.\n  error NotAuthorized();\n\n  /// @notice Thrown when the named VoterPaymentsModule is not one the escrow authorizes.\n  error ModuleNotAuthorized();\n\n  /// @notice Thrown at construction when the Relay does not own the sAERO it is being bound to.\n  error NotTokenOwner();\n\n  /// @notice Thrown at construction when the bound sAERO carries less than `MIN_STAKE_AMOUNT` of\n  ///         initial stake (the seed that blocks the first-depositor inflation attack).\n  error SeedTooSmall();\n\n  /// @notice Thrown on a permissioned Relay when a deposit or share transfer hits an address not on the allow list.\n  error NotAllowed();\n\n  /// @notice Thrown when a requested deposit is below the configured minimum.\n  error BelowMinimumDeposit();\n\n  /// @notice Thrown when a requested deposit would mint zero shares at the current share ratio.\n  error ZeroShares();\n\n  /// @notice Thrown when a registered withdrawal is zero, is below the configured minimum, or would leave a\n  ///         free remainder below it. The holder's whole free position is always accepted.\n  error BelowMinimumWithdrawal();\n\n  /// @notice Thrown when processing the deposit queue with nothing pending.\n  error NoPendingDeposits();\n\n  /// @notice Thrown when processing overdue deposits with an empty ids array.\n  error EmptyDepositIds();\n\n  /// @notice Thrown when processing a deposit id that was never issued.\n  error DepositNotFound();\n\n  /// @notice Thrown when every deposit entry named for processing was already processed.\n  error DepositAlreadyProcessed();\n\n  /// @notice Thrown when an amount exceeds the un-accounted balance on hand (`balanceOf - accountedBalance`).\n  error RewardExceedsBalance();\n\n  /// @notice Thrown when a zero address is supplied where a non-zero one is required.\n  error ZeroAddress();\n\n  /// @notice Thrown at construction when `minDeposit` is below `MIN_STAKE_AMOUNT`, or when\n  ///         `minWithdrawal` is zero. A zero floor admits a zero-amount entry, and a zero-share exit\n  ///         permanently stalls the withdraw FIFO; a dust deposit floor bounds no rounding loss.\n  error QueueFloorTooSmall();\n\n  /// @notice Thrown when registering a withdrawal for more shares than the caller has free\n  ///         (un-escrowed). An open Relay checks both satellites; a closed one checks the\n  ///         principal alone.\n  error InsufficientFreeShares();\n\n  /// @notice Thrown when a transfer would move shares the holder has escrowed into the withdraw queue.\n  error EscrowedSharesLocked();\n\n  /// @notice Thrown on `renounceOwnership`: a vacant owner seat would freeze every owner-gated path,\n  ///         so the ownership can only be handed over.\n  error OwnershipRenounceDisabled();\n\n  /// @notice Thrown when a public grant, revoke or renounce names a restricted role.\n  error RoleRestricted();\n\n  /// @notice Thrown on the permissionless deposit path when the named entry is still within keeperWindow.\n  error KeeperWindowNotElapsed();\n\n  /// @notice Thrown when initializing a Relay with a zero entrypoint timelock.\n  error InvalidEntrypointTimelock();\n\n  /// @notice Thrown when a Relay whose entrypoints are fixed at initialization names neither a\n  ///         compounder nor a converter: rewards reaching it could never be processed. A Relay\n  ///         starting as Protocol L2 is exempt, it attaches entrypoints through the timelocked flow.\n  error MissingEntrypoint();\n\n  /// @notice Thrown when registering an exit whose destination is the Relay's own sAERO or an id that does\n  ///         not fit the stored destination field.\n  error InvalidDestination();\n\n  /// @notice Thrown when notifying or claiming a token not in the reward registry.\n  error UnknownRewardToken();\n\n  /// @notice Thrown when adding a reward token already present in the registry.\n  error RewardTokenAlreadyAdded();\n\n  /// @notice Thrown when a Maxi or Protocol L1 Relay tries to register a second reward token.\n  error RewardRegistryLocked();\n\n  /// @notice Thrown when registering a reward token would exceed `MAX_REWARD_TOKENS`.\n  error RewardRegistryFull();\n\n  /// @notice Thrown when registering a reward token that holds no code, which no claim could\n  ///         ever transfer out.\n  error RewardTokenNotAContract();\n\n  /// @notice Thrown when registering the Relay itself or one of its satellites as a reward token.\n  error InvalidRewardToken();\n\n  /// @notice Thrown when dropping a reward token that already distributed a batch, whose holders\n  ///         would lose the rights it left behind.\n  error RewardTokenPaid();\n\n  /// @notice Thrown when promoting a Relay that is not Protocol L1, or initializing a tier without\n  ///         an L2 path with `startAsLevel2`.\n  error NotPromotable();\n\n  /// @notice Thrown when initializing an allow-listed tier with a transferable yield token: a\n  ///         kicked holder who sold YT would have no pair left to burn, so eviction would be a no-op.\n  error TransferableYieldTokenNotAllowed();\n\n  /// @notice Thrown when a satellite token implementation holds no code, which a clone of it cannot report.\n  error ImplementationNotAContract();\n\n  /// @notice Thrown when a cloned satellite token did not come out bound to this Relay with the\n  ///         requested transferability.\n  error SatelliteNotInitialized();\n\n  /// @notice Thrown when a Level-2-only action (e.g. sweep) runs on a Maxi or Protocol L1 Relay.\n  error NotLevel2();\n\n  /// @notice Thrown when proposing an entrypoint for a role other than COMPOUNDER or CONVERTER.\n  error InvalidEntrypointRole();\n\n  /// @notice Thrown when executing an entrypoint attachment that was never proposed.\n  error EntrypointNotProposed();\n\n  /// @notice Thrown when proposing an entrypoint that is bound to a different Relay.\n  error EntrypointNotBound();\n\n  /// @notice Thrown when executing an entrypoint attachment before its timelock has elapsed.\n  error EntrypointTimelockNotElapsed();\n\n  /// @notice Thrown when executing a leaf recipient that was never proposed, or already landed.\n  error LeafRecipientNotProposed();\n\n  /// @notice Thrown when executing a proposed leaf recipient before its timelock has elapsed.\n  error LeafRecipientTimelockNotElapsed();\n\n  /// @notice Thrown when proposing a leaf recipient for the Relay's own chain, whose claims always\n  ///         pay the Relay itself.\n  error LeafRecipientOnRoot();\n\n  /// @notice Thrown when executing an operator for a chain that has no proposal pending.\n  error OperatorNotProposed();\n\n  /// @notice Thrown when executing an operator proposal before its timelock has elapsed.\n  error OperatorTimelockNotElapsed();\n\n  /// @notice Thrown when an allocation, a deposit request or a close reaches a permanently\n  ///         closed Relay.\n  error RelayClosed();\n\n  /// @notice Thrown when evacuating an open Relay: the dispatch requires the closed state.\n  error RelayNotClosed();\n\n  /// @notice Thrown when a flexible-vote cast would send calldata whose selector is not the\n  ///         Governor's fractional cast, so a rotated Governor cannot bear arbitrary authority.\n  error UnexpectedCastSelector();\n\n  /// @notice Thrown at initialization when the evacuation window is zero, which would let anyone\n  ///         close a working Relay.\n  error InvalidEvacuationWindow();\n\n  /// @notice Thrown at initialization when the keeper window is zero, which would make the overdue\n  ///         drain permissionless from the first block.\n  error InvalidKeeperWindow();\n\n  /// @notice Thrown at initialization when `lockWeeks` disagrees with the seed stake's permanence:\n  ///         a permanent seed with non-zero `lockWeeks` would revert every lock extension, and a\n  ///         time-locked seed with zero `lockWeeks` would silently decay.\n  error LockWeeksMismatch();\n\n  /// @notice Thrown at initialization when `lockWeeks` reaches past the escrow's MAXTIME once its\n  ///         week floor is applied, which would make the lock refresh fail part of every week.\n  error LockWeeksTooLong();\n\n  /// @notice Thrown when closing a Relay whose withdraw queue is empty.\n  error NoQueuedWithdrawal();\n\n  /// @notice Thrown when closing a Relay before the oldest queued withdrawal has waited a full evacuation window.\n  error EvacuationWindowNotElapsed();\n\n  /// @notice Thrown when closing a Relay whose oldest queued withdrawal the free chain0 weight can pay: the remedy\n  ///         is a drain, not a shutdown.\n  error HeadIsCovered();\n\n  /// @notice Thrown when an evacuation names a chain holding no booked weight.\n  error NothingToEvacuate();\n\n  /// @notice Thrown when an allocation carries no chain and no gauge dispatches.\n  error EmptyAllocation();\n\n  /// @notice Thrown when an allocation's growth exceeds the free chain0 weight minus the withdrawal\n  ///         reserve, the queue's share of the whole stake, which is owed before anything else is\n  ///         allocated.\n  error InsufficientFreeWeight();\n\n  /// @notice Thrown when a claim resolves to a zero payout.\n  error NothingToClaim();\n\n  /// @notice Thrown when a leaf-chain claim has no configured recipient (it cannot dispatch to zero).\n  error RecipientNotSet();\n\n  /// @notice Thrown when a root claim is funded with msg.value (no cross-chain dispatch, no fee).\n  error NoValueOnRootClaim();\n\n  /// @notice Thrown when notifying a reward while the share supply is zero.\n  error NoSupply();\n\n  /// @notice Thrown when compounding into a Relay with no principal outstanding, where the added\n  ///         backing would have no claimant.\n  error NoPrincipalSupply();\n\n  /// @notice Thrown when a reward batch is too small to advance the per-share index (it would floor\n  ///         to zero and lock as owed-but-undistributed).\n  error RewardTooSmall();\n\n  /// @notice Thrown when the caller held no principal token at the proposal snapshot.\n  error NoVotingPower();\n\n  /// @notice Thrown when the caller has already consumed their full slice on this proposal.\n  error AlreadyVoted();\n\n  /// @notice Thrown when the requested fractional weights exceed the caller's remaining slice.\n  error ExceedsRemainingSlice();\n\n  /// @notice Thrown when governance support is not 0/1/2/255, or the params length disagrees with it.\n  error InvalidSupport();\n\n  /// @notice Thrown at construction when the rake ceiling is not below `MAX_PIPS`.\n  error InvalidRakeCeiling();\n\n  /// @notice Thrown when a rake rate exceeds `MAX_RAKE_PIPS`.\n  error RakeAboveCeiling();\n\n  /// @notice Thrown when executing a rake change while none is pending.\n  error NoPendingRakes();\n\n  /// @notice Thrown when executing a rake change before its timelock has elapsed.\n  error RakeTimelockActive();\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                    FUNCTIONS                                       __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Initializes a freshly cloned Relay. Callable once, by the factory, in the\n  ///         clone-creation transaction.\n  /// @param _params Initialization inputs (operators, entrypoints, tier flag, configuration).\n  function initialize(InitParams memory _params) external;\n\n  /// @notice Requests an async deposit from the caller's sAERO, crediting the eventual shares to\n  ///         the sAERO's current owner. No shares mint here: the entry waits on the deposit queue\n  ///         until the keeper processes it, or anyone after it ages past `keeperWindow`.\n  /// @param _tokenId Source sAERO whose weight enters the Relay.\n  /// @param _amount Staking weight pulled from the source sAERO; the Relay records the net weight\n  ///        after the VPM protocol fee.\n  function requestDeposit(uint256 _tokenId, uint256 _amount) external;\n\n  /// @notice Requests an async deposit from the caller's sAERO, naming the share recipient.\n  /// @param _tokenId Source sAERO whose weight enters the Relay.\n  /// @param _amount Staking weight pulled from the source sAERO (gross of the VPM protocol fee).\n  /// @param _recipient Address the shares mint to at admission.\n  function requestDeposit(uint256 _tokenId, uint256 _amount, address _recipient) external;\n\n  /// @notice Keeper entry that processes pending deposits in request order and mints shares.\n  /// @param _maxEntries Max deposit-queue entries to visit this call; a consumed entry the walk\n  ///        visits spends budget like a live one.\n  /// @dev The keeper triggers the entrypoints first so existing holders capture the reward batch,\n  ///      then processes deposits so fresh shares mint at the settled ratio.\n  function processPending(uint256 _maxEntries) external;\n\n  /// @notice Permissionless liveness fallback: process the named pending deposits after each one\n  ///         ages past `keeperWindow`, so neither the keeper nor a backlog can block an entry.\n  /// @param _ids Deposit-queue ids to process, in the given order.\n  /// @dev Skips an entry that was already processed, and reverts if nothing is left to process.\n  ///      Also reverts on an empty ids array, an id that was never issued, or an entry that is\n  ///      still inside the keeper window.\n  function processOverduePending(uint256[] calldata _ids) external;\n\n  /// @notice Registers an exit: escrows `_shares` into the FIFO withdraw queue, to be settled later\n  ///         against the idle chain0 weight. Permissionless; cannot be cancelled.\n  /// @param _shares Shares to escrow and burn at drain.\n  /// @param _destination Existing sAERO the weight is sent to, or MINT_SENTINEL for a freshly minted\n  ///        one. Read at settlement rather than now: the weight lands on that sAERO, whoever owns it\n  ///        then. `processWithdrawals` says when a fresh sAERO replaces it. `InvalidDestination` lists\n  ///        the rejected ids.\n  /// @dev Escrowed shares stay on the holder, accruing rewards until burned, but are locked in\n  ///      place. On a closed Relay the free-share cover is asked of the principal alone, so a\n  ///      holder that sold its yield side can still leave; the drain mirrors this and burns only\n  ///      the principal past closure, leaving the yield token its claim on the reward tail.\n  function registerOnWithdrawQueue(uint256 _shares, uint256 _destination) external;\n\n  /// @notice Drains up to `_maxEntries` queued exits against the free chain0 weight, read live from\n  ///         the Voter. Permissionless: the caller picks no route.\n  /// @param _maxEntries Max exits to settle this call.\n  /// @dev An exit registered with `MINT_SENTINEL`, and every eviction, goes to a fresh sAERO minted to\n  ///      the holder. The mint skips the ERC-721 receiver check, so a holder that is a contract must be\n  ///      able to use the sAERO. Any other exit goes to its registered sAERO, unless that sAERO does\n  ///      not exist or unlocks before the Relay's own: then it falls back to a fresh sAERO too. On a\n  ///      permanent Relay, any decaying destination falls back, whatever its unlock. Zero, the escrow's\n  ///      fee accumulator, is permanent, so an exit naming it settles there and hands the weight to the\n  ///      protocol.\n  /// @dev The drain stops early when the free weight no longer covers the next exit.\n  function processWithdrawals(uint256 _maxEntries) external;\n\n  /// @notice Allocates the pooled voting power: forwards the caller's chain and gauge dispatches to\n  ///         the Voter in one composed call. The Relay stores no strategy.\n  /// @param _chainDispatches Per-chain additive deltas funded from the idle chain0 weight, with\n  ///        their dispatch funding; strictly ascending. A zero delta only refreshes the chain's\n  ///        stored shape.\n  /// @param _gaugeDispatches Per-chain gauge overwrites with their dispatch funding. A list must\n  ///        cover the chain's booked amount exactly; a `DEALLOC_GAUGE` entry starts a leaf-first\n  ///        return of that amount to chain0, its return cost paid from the entry's `value`.\n  /// @param _refundRecipient Recipient of any unused dispatch value, refunded by the transport.\n  /// @dev The Relay checks only the withdrawal reserve and the closed flag; the Voter validates\n  ///      everything else (ordering, chain status, gauge budgets, the msg.value split).\n  function allocate(\n    IVoter.ChainAllocationDispatch[] calldata _chainDispatches,\n    IVoter.GaugeAllocationDispatch[] calldata _gaugeDispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /// @notice Refreshes the Relay sAERO's lock to its configured horizon. Permissionless; a no-op\n  ///         on permanent Relays.\n  function extendLock() external;\n\n  /// @notice Permanently closes the Relay. Permissionless when the oldest queued withdrawal has waited a full\n  ///         evacuation window and the free chain0 weight cannot pay it; the owner closes at will. The allocated\n  ///         chains come home afterwards through `evacuate`, one per call.\n  function close() external;\n\n  /// @notice Pulls the named chain's full booked weight back to chain0 on a closed Relay.\n  ///         Permissionless, and a chain whose message never applied can be re-dispatched.\n  /// @param _chainId Allocated chain whose full booked weight returns; the Voter enforces its own\n  ///        chain rules on the dispatch.\n  /// @param _gasLimit Destination gas for the leaf message; msg.value covers the dispatch fee and\n  ///        the chain's deallocation return cost, quoted off-chain.\n  /// @param _refundRecipient Recipient of any unused dispatch value.\n  function evacuate(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Pulls the Relay's weight off a suspended chain straight back to chain0 through the\n  ///         Voter's emergency path. KEEPER-gated while the Relay is open; permissionless once\n  ///         closed.\n  /// @param _chainId Suspended chain whose full booked weight returns.\n  /// @param _gasLimit Destination gas for the emergency message to the leaf.\n  /// @param _refundRecipient Recipient of any unused dispatch value.\n  /// @dev The Voter enforces its own preconditions (the chain is Suspended and emergency\n  ///      deallocation is enabled for it) and credits chain0 synchronously.\n  function emergencyDeallocate(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Expresses a governance preference as a principal-token holder: the Relay casts a\n  ///         fractional vote with its own sAERO, sized to the caller's snapshot slice.\n  /// @param _proposalId Proposal being voted on.\n  /// @param _support Preference: 0 Against, 1 For, 2 Abstain (empty params, spends the whole\n  ///        remaining slice), or 255 fractional (params carry three packed `uint128` weights).\n  /// @param _params Counting-module params matching `_support`.\n  /// @param _reason Free-form reason string forwarded to the Governor.\n  /// @dev Permissionless: the slice itself is the gate — a caller with no checkpointed principal\n  ///      at the snapshot prices to zero and is rejected.\n  function expressVote(uint256 _proposalId, uint8 _support, bytes calldata _params, string calldata _reason) external;\n\n  /// @notice Hands `_amount` of `_token` to the calling entrypoint for swapping; the swap output\n  ///         must land back on the Relay.\n  /// @param _token Reward token to pull out to the entrypoint.\n  /// @param _amount Amount to transfer to the caller.\n  /// @dev Gated to either entrypoint role. Bounded to the un-accounted balance, so an entrypoint\n  ///      can never pull reward tokens already owed to claimants.\n  function pull(address _token, uint256 _amount) external;\n\n  /// @notice Appreciation lane: stakes `_amount` of TOKEN held by the Relay, minus the rake, into\n  ///         the Relay sAERO, raising the backing without minting shares.\n  /// @param _amount Gross TOKEN amount; the rake comes out of it.\n  /// @dev Bounded to the un-accounted TOKEN, so it can never stake TOKEN already owed to claimants.\n  ///      With tape recording enabled, too little gas left for the record reverts\n  ///      (`IRelayFactory.InsufficientGasForCall`), so an estimator prices the call to record rather\n  ///      than to skip; a tape that fails on its own is still swallowed by the factory.\n  function compound(uint256 _amount) external;\n\n  /// @notice Moves this Relay onto another VoterPaymentsModule.\n  /// @param _vpm The module to move to; it must be one the escrow currently authorizes.\n  function setVoterPaymentsModule(IVoterPaymentsModule _vpm) external;\n\n  /// @notice Points this Relay at another Governor, naming the adapter that speaks its dialect.\n  ///         The slice math and the consumption ledger stay on the Relay; only the snapshot read\n  ///         and the cast encoding go through the adapter.\n  /// @param _governor The Governor every later `expressVote` casts into.\n  /// @param _voteAdapter The adapter translating casts for it; both must be non-zero.\n  function setGovernor(IGovernor _governor, IRelayVoteAdapter _voteAdapter) external;\n\n  /// @notice Registers a reward token so the accumulator settles it. Maxi/L1 lock the registry\n  ///         after the first token; L2 grows it up to `MAX_REWARD_TOKENS`.\n  /// @param _token Reward token to add to the registry.\n  /// @dev Late registration needs no bootstrapping: index and checkpoints default to zero, so the\n  ///      first `notifyReward` accrues proportionally to current holders.\n  function addRewardToken(address _token) external;\n\n  /// @notice Drops a reward token that never distributed anything, reopening its registry slot.\n  /// @param _token Reward token to drop.\n  /// @dev The undo of a misregistration, and the only way back on the single-slot tiers, where the\n  ///      first token otherwise closes the registry for good. A token that ever paid stays: the\n  ///      accumulator settles and claims only registered tokens, so dropping it would freeze the\n  ///      rights it left behind.\n  function removeRewardToken(address _token) external;\n\n  /// @notice Proposes the recipient that fee/incentive claims for `_chainId` land at on that chain.\n  /// @param _chainId Leaf chain the recipient applies to; the Relay's own chain is rejected, since\n  ///        its claims always pay the Relay itself.\n  /// @param _recipient Address claims for that chain would be sent to; zero is rejected, since\n  ///        disabling a chain is `clearLeafRecipient` and needs no delay.\n  /// @dev Pointing claims at a new address hands reward custody to it, the same economic move as\n  ///      attaching an entrypoint, so it waits out the same delay. Claims keep resolving to the\n  ///      current recipient meanwhile, and the claim wrapper is permissionless, so anyone can move\n  ///      the outstanding accrual to the current custody before a proposal lands. One live proposal\n  ///      per chain: proposing again replaces it and restarts the delay.\n  function proposeLeafRecipient(uint256 _chainId, address _recipient) external;\n\n  /// @notice Lands the proposed recipient for `_chainId` once its timelock has elapsed.\n  /// @param _chainId Leaf chain whose proposal is executed.\n  function executeLeafRecipient(uint256 _chainId) external;\n\n  /// @notice Disables Relay-orchestrated claims for `_chainId`.\n  /// @param _chainId Leaf chain to disable.\n  /// @dev Immediate, with no delay: it only removes a capability, so a compromised transport is cut\n  ///      off at once. A proposal pending for the chain stays; `cancelLeafRecipient` drops it. It\n  ///      only closes the `claimRewards` route: an operator seated on the chain keeps claiming there\n  ///      on its own, and leaves through `revokeOperator`.\n  function clearLeafRecipient(uint256 _chainId) external;\n\n  /// @notice Cancels the leaf recipient proposal pending for `_chainId`, if any.\n  /// @param _chainId Leaf chain whose proposal is dropped.\n  /// @dev The current recipient stays, so claims keep working.\n  function cancelLeafRecipient(uint256 _chainId) external;\n\n  /// @notice Proposes the operator of the Relay's sAERO on `_chainId`.\n  /// @param _chainId Leaf chain the operator would act on.\n  /// @param _operator Address proposed as operator; zero is rejected, since clearing the seat is\n  ///        `revokeOperator` and needs no delay.\n  /// @dev An operator can call `claimRewards` on the leaf naming any recipient it likes, and on its\n  ///      own schedule. Naming one therefore hands over the same reward custody `leafRecipient`\n  ///      does, by a route that does not read `leafRecipient` at all, so it waits out the same\n  ///      delay. Without it the delay on `leafRecipient` would be worth nothing: an owner could\n  ///      seat an operator instead and take the same value immediately. The seat is not only\n  ///      claims: on a leaf where governance enabled local voting, the operator can also\n  ///      redistribute the Relay's gauge allocations (`LeafVoter.allocateGauges`). One live\n  ///      proposal per chain: proposing again replaces it and restarts the delay.\n  function proposeOperator(uint256 _chainId, address _operator) external;\n\n  /// @notice Sends the proposed operator for `_chainId` to that chain, once its timelock elapsed.\n  /// @param _chainId Leaf chain whose proposal is executed.\n  /// @param _gasLimit Destination gas budget for the leaf call.\n  /// @param _refundRecipient Address that receives unused dispatch value.\n  /// @dev Payable: the Voter charges for the cross-chain message, paid from `msg.value`.\n  function executeOperator(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Clears the operator on `_chainId` and cancels any proposal pending for it.\n  /// @param _chainId Leaf chain to clear the seat on.\n  /// @param _gasLimit Destination gas budget for the leaf call.\n  /// @param _refundRecipient Address that receives unused dispatch value.\n  /// @dev No delay, since it only removes a capability. It reaches the seat through the Voter, so\n  ///      it carries the Voter's own limits: it reverts on `CHAIN0`, on an unregistered chain, and\n  ///      on a `Paused` one. A paused chain is the gap worth knowing about, because the leaf keeps\n  ///      honouring the seated operator while it lasts: `LeafVoter.claimRewards` has no chain-status\n  ///      gate. Cancelling the proposal still works there, through `cancelOperator`; emptying the\n  ///      seat has to wait for the chain to leave `Paused`.\n  function revokeOperator(uint256 _chainId, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /// @notice Cancels the operator proposal pending for `_chainId`, if any.\n  /// @param _chainId Leaf chain whose proposal is dropped.\n  /// @dev Root-only and free: it touches no chain state and sends no message, so it works whatever\n  ///      the Voter thinks of the chain. That is the point. `revokeOperator` also drops the\n  ///      proposal, but it reverts with the dispatch, so it cannot cancel one aimed at a chain the\n  ///      Voter refuses to message. Without this path such a proposal would sit there forever, and\n  ///      one named for `CHAIN0` could never be executed nor removed.\n  function cancelOperator(uint256 _chainId) external;\n\n  /// @notice Replaces the Relay's display name, read by frontends and analytics.\n  /// @param _name The new name.\n  /// @dev Not the ERC-20 `name()` of either satellite token; those are fixed at initialization and\n  ///      a rename leaves them untouched. They must stay fixed: Solady builds the EIP-712 domain\n  ///      from `name()`, so a moved name would void every unspent `permit` and delegation signature.\n  function setName(string calldata _name) external;\n\n  /// @notice Accumulator lane: distributes `_amount` of `_token`, minus the rake, to all current\n  ///         holders by advancing its per-share index.\n  /// @param _token Reward token being distributed.\n  /// @param _amount Gross batch; the rake comes out of it.\n  /// @dev `_amount` cannot exceed the un-accounted balance that actually arrived. Reverts on an\n  ///      unregistered token or zero supply. With tape recording enabled, too little gas left for\n  ///      the record reverts as well (`IRelayFactory.InsufficientGasForCall`), so an estimator\n  ///      prices the call to record rather than to skip; a tape that fails on its own is still\n  ///      swallowed by the factory.\n  function notifyReward(address _token, uint256 _amount) external;\n\n  /// @notice Pays out the caller's accrued reward in `_token` to `_to`, without burning shares.\n  /// @dev Each settle rounds the holder's credit down to the token's smallest unit. The remainder stays\n  ///      in `accountedBalance` with no owner. A settle runs on every yield-token balance change. A third\n  ///      party can trigger one with a transfer to the holder, or with a deposit to the holder while the\n  ///      Relay is open.\n  /// @param _token Reward token to claim.\n  /// @param _to Recipient of the payout.\n  /// @return _amount Reward amount transferred.\n  function claim(address _token, address _to) external returns (uint256 _amount);\n\n  /// @notice Claims the Relay's accrued fee and incentive rewards for `_chainId` to the recipient\n  ///         configured for that chain, funding the dispatch with msg.value. Permissionless\n  ///         pass-through to the Voter.\n  /// @param _chainId Chain to claim rewards on: the local chain for a root claim, a leaf otherwise.\n  /// @param _gasLimit Destination gas budget for the leaf claim dispatch (ignored on a root claim).\n  /// @param _feeClaims Fee claim requests forwarded to the Voter; the keeper picks and sizes them.\n  /// @param _incentiveClaims Incentive claim requests forwarded to the Voter; the keeper picks and\n  ///        sizes them.\n  /// @dev The recipient is read from per-chain config, never from the caller, so a caller can only\n  ///      fund and trigger. A root claim must carry zero value.\n  function claimRewards(\n    uint256 _chainId,\n    uint256 _gasLimit,\n    ILeafVoter.FeeClaim[] calldata _feeClaims,\n    ILeafVoter.IncentiveClaim[] calldata _incentiveClaims\n  ) external payable;\n\n  /// @notice Seats or removes a RAKE_MANAGER.\n  /// @param _account Address whose RAKE_MANAGER role changes.\n  /// @param _enabled True to seat, false to remove.\n  function setRakeManager(address _account, bool _enabled) external;\n\n  /// @notice Hands the RAKE_MANAGER_ADMIN seat to a successor, named by the sitting admin.\n  /// @param _newAdmin Address receiving the seat.\n  function transferRakeManagerAdmin(address _newAdmin) external;\n\n  /// @notice Proposes rake rates; a raise waits out `entrypointTimelock`, a cut applies at once.\n  /// @param _protocolPips Protocol rake, at most `MAX_RAKE_PIPS`.\n  /// @param _allocatorPips Allocator rake, at most `MAX_RAKE_PIPS`.\n  function proposeRakes(uint256 _protocolPips, uint256 _allocatorPips) external;\n\n  /// @notice Applies the pending rake pair once its timelock has elapsed.\n  function executeRakes() external;\n\n  /// @notice Sends the protocol lane of each token to the factory's rake treasury. Permissionless.\n  /// @param _tokens Tokens to collect; a token with nothing accrued is skipped.\n  function collectProtocolFees(address[] calldata _tokens) external;\n\n  /// @notice Sends the allocator lane of each token to `_recipient`.\n  /// @param _tokens Tokens to collect; a token with nothing accrued is skipped.\n  /// @param _recipient Non-zero recipient of the fees.\n  function collectAllocatorFees(address[] calldata _tokens, address _recipient) external;\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                  VIEW FUNCTIONS                                    __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Total reward in `_token` claimable by `_holder` right now: settled pending plus the\n  ///         not-yet-settled accrual since their last checkpoint.\n  /// @param _holder Holder to price.\n  /// @param _token Reward token to price.\n  /// @return _amount Claimable reward amount.\n  function claimable(address _holder, address _token) external view returns (uint256 _amount);\n\n  /// @notice Whether `_token` is in the reward registry (gates `notifyReward` and `claim`).\n  /// @param _token Token to check.\n  /// @return _registered True when the token is registered.\n  function isRewardToken(address _token) external view returns (bool _registered);\n\n  /// @notice The registered reward tokens, in registration order.\n  /// @return _tokens The reward-token registry as an array.\n  function rewardTokens() external view returns (address[] memory _tokens);\n\n  /// @notice The Relay tier, for on-chain discovery. Implemented by each concrete subclass.\n  /// @return _relayType The tier (Maxi, ProtocolL1 or ProtocolL2).\n  function relayType() external view returns (RelayType _relayType);\n\n  /// @notice The Relay's configuration block (tokenId, minimums, queue limits, caps, name/symbol).\n  /// @return _config The full configuration struct.\n  function relayConfig() external view returns (RelayConfig memory _config);\n\n  /// @notice The rake rates and the pending rate change.\n  /// @return _rakes The rake state.\n  function rakes() external view returns (RakeState memory _rakes);\n\n  /// @notice Withdraw destination sentinel: route the weight to a freshly minted sAERO.\n  /// @return _sentinel The mint sentinel value.\n  function MINT_SENTINEL() external view returns (uint256 _sentinel);\n\n  /// @notice Hard cap on the reward-token registry, bounding the per-transfer settle loop's gas.\n  /// @return _max The maximum number of registered reward tokens (10).\n  function MAX_REWARD_TOKENS() external view returns (uint256 _max);\n\n  /// @notice Fixed-point scaling factor for the per-share reward accumulator.\n  /// @return _scale The accumulator scaling factor (1e27).\n  /// @dev Each notify leaves under `yieldToken.totalSupply() / ACC_SCALE` raw units un-accounted for\n  ///      the next batch. This scale keeps that below one unit at any realistic supply, also for a\n  ///      reward token with few decimals. The cost is a ceiling of `2^256 / ACC_SCALE` on one notify.\n  function ACC_SCALE() external view returns (uint256 _scale);\n\n  /// @notice VotingEscrow that custodies the staked TOKEN; weight only moves through the VPM.\n  /// @return _votingEscrow The VotingEscrow contract.\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /// @notice Voter that owns allocation, the vote cooldown and cross-chain dispatch.\n  /// @return _voter The Voter contract.\n  function VOTER() external view returns (IVoter _voter);\n\n  /// @notice The underlying protocol TOKEN staked behind the sAERO, read from VotingEscrow.\n  /// @return _token The protocol TOKEN address.\n  function TOKEN() external view returns (address _token);\n\n  /// @notice Implementation cloned as the principal token (PT): a checkpointed RelayToken\n  ///         (`RelayTokenVotes`), so governance can price a holder's weight at a past timepoint.\n  /// @return _implementation The principal-token implementation address.\n  function PRINCIPAL_TOKEN_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice Implementation cloned as the yield token (YT): the plain RelayToken, no checkpoints.\n  /// @return _implementation The yield-token implementation address.\n  function YIELD_TOKEN_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice Wrapped native token every native inflow is wrapped into.\n  /// @return _wrappedNative The wrapped native token address.\n  function WRAPPED_NATIVE() external view returns (address _wrappedNative);\n\n  /// @notice Ceiling of each rake rate, in pips.\n  /// @return _maxRakePips The rake ceiling.\n  function MAX_RAKE_PIPS() external view returns (uint256 _maxRakePips);\n\n  /// @notice Factory that initialized this Relay; it names the rake treasury.\n  /// @return _factory The factory address.\n  function factory() external view returns (address _factory);\n\n  /// @notice The principal token (PT): the priced position carrying the withdraw right.\n  /// @return _principalToken The principal token clone.\n  function principalToken() external view returns (IRelayToken _principalToken);\n\n  /// @notice The yield token (YT): the balance the reward accumulator reads.\n  /// @return _yieldToken The yield token clone.\n  function yieldToken() external view returns (IRelayToken _yieldToken);\n\n  /// @notice Deposit-queue entries by id: async deposits that wait for processing. A consumed\n  ///         entry is deleted, so it reads back as all zeroes; the history lives in the events.\n  /// @param _id Deposit-queue id to read.\n  /// @return _recipient Address the shares mint to, named at request.\n  /// @return _requestedAt Timestamp the deposit was requested; zero once the entry is consumed.\n  /// @return _tokenId Source sAERO of the pending deposit.\n  /// @return _amount Staking weight queued by the deposit.\n  function pendingDeposits(uint256 _id)\n    external\n    view\n    returns (address _recipient, uint48 _requestedAt, uint128 _tokenId, uint128 _amount);\n\n  /// @notice Bookkeeping of the deposit queue (see `DenseQueue.Queue`).\n  /// @return _head Earliest id the walk must still visit (possibly a consumed entry), or zero.\n  /// @return _tail Last issued id, or zero while no request was made.\n  /// @return _count Outstanding (live) entries.\n  function depositList() external view returns (uint40 _head, uint40 _tail, uint40 _count);\n\n  /// @notice TOKEN-denominated weight backing the current shares: admitted deposits plus compounds\n  ///         minus withdrawals. An internal counter, never read from `balanceOf` or `VE.staked()`,\n  ///         so a donation cannot inflate the share price.\n  /// @return _backing The current backing counter.\n  function totalBacking() external view returns (uint256 _backing);\n\n  /// @notice VoterPaymentsModule this Relay currently moves weight through; movable because the\n  ///         module the Relay started on can lose its escrow authorization.\n  /// @return _vpm The VoterPaymentsModule contract.\n  function vpm() external view returns (IVoterPaymentsModule _vpm);\n\n  /// @notice Governor `expressVote` casts into. Set at initialization, movable through `setGovernor`.\n  /// @return _governor The Governor contract.\n  function governor() external view returns (IGovernor _governor);\n\n  /// @notice Adapter translating casts into the Governor's dialect, consulted by STATICCALL only.\n  ///         Set at initialization, movable through `setGovernor`.\n  /// @return _voteAdapter The vote adapter.\n  function voteAdapter() external view returns (IRelayVoteAdapter _voteAdapter);\n\n  /// @notice Reward-token balance already notified into the accumulator and not yet claimed, plus\n  ///         the uncollected rake; the un-accounted remainder is all notify/compound may spend.\n  ///         Invariant: `balanceOf(token) >= accountedBalance[token]`.\n  /// @param _token Token to read.\n  /// @return _accounted The accounted balance for the token.\n  function accountedBalance(address _token) external view returns (uint256 _accounted);\n\n  /// @notice Per-token accumulator: reward-per-share scaled by ACC_SCALE, advanced by `notifyReward`.\n  /// @param _token Token to read.\n  /// @return _index The per-share accumulator for the token.\n  function rewardIndex(address _token) external view returns (uint256 _index);\n\n  /// @notice Per-(holder, token) snapshot of `rewardIndex` at the holder's last settle.\n  /// @param _holder Holder to read.\n  /// @param _token Token to read.\n  /// @return _checkpoint The holder's last-settled index for the token.\n  function userCheckpoint(address _holder, address _token) external view returns (uint256 _checkpoint);\n\n  /// @notice Per-(holder, token) reward settled into a claimable balance but not yet claimed.\n  /// @param _holder Holder to read.\n  /// @param _token Token to read.\n  /// @return _pending The holder's settled, unclaimed reward for the token.\n  function pendingReward(address _holder, address _token) external view returns (uint256 _pending);\n\n  /// @notice Registered exits awaiting drain, stored by id. A settled exit is deleted, so it reads\n  ///         back as all zeroes; the history lives in the events.\n  /// @param _id Withdraw-queue id to read.\n  /// @return _holder Owner of the escrowed shares for the entry.\n  /// @return _registeredAt Registration timestamp anchoring the evacuation clock.\n  /// @return _shares Shares escrowed by the entry.\n  /// @return _destination Registered destination sAERO, or `MINT_SENTINEL` when the exit mints a fresh\n  ///         one. The drain can still fall back to a fresh sAERO (see `processWithdrawals`).\n  function withdrawals(uint256 _id)\n    external\n    view\n    returns (address _holder, uint48 _registeredAt, uint256 _shares, uint256 _destination);\n\n  /// @notice Bookkeeping of the withdraw queue (see `DenseQueue.Queue`).\n  /// @return _head Id of the oldest exit that still waits, or zero when the queue is drained.\n  /// @return _tail Last issued id, or zero while no exit was ever registered.\n  /// @return _count Outstanding (undrained) exits.\n  function withdrawQueue() external view returns (uint40 _head, uint40 _tail, uint40 _count);\n\n  /// @notice Total shares escrowed across all queued withdrawals not yet drained; the drain\n  ///         settles these against the idle chain0 weight.\n  /// @return _shares The escrowed, undrained share total.\n  function pendingWithdrawalShares() external view returns (uint256 _shares);\n\n  /// @notice Shares each holder has locked into the withdraw queue: still on the holder's balances,\n  ///         accruing rewards until burned, but locked in place. One counter locks the PT/YT pair\n  ///         in equal units.\n  /// @param _holder Holder to read.\n  /// @return _shares The holder's escrowed (queued, undrained) share amount.\n  function escrowedShares(address _holder) external view returns (uint256 _shares);\n\n  /// @notice Whether the Relay is permanently closed. A closed Relay only winds down: no new\n  ///         allocations, no new deposit requests; exits keep settling as returns land.\n  /// @return _closed True once the Relay has been closed.\n  function closed() external view returns (bool _closed);\n\n  /// @notice Per-leaf-chain recipient that fee/incentive claims land at on that chain. Zero\n  ///         disables Relay-orchestrated claims for the chain; a seated operator claims regardless.\n  /// @param _chainId Leaf chain to read.\n  /// @return _recipient The configured claim recipient for the chain (zero when unset).\n  function leafRecipient(uint256 _chainId) external view returns (address _recipient);\n\n  /// @notice Recipient proposed for a leaf chain, waiting out its timelock. Zero recipient means\n  ///         nothing is pending.\n  /// @param _chainId Leaf chain to read.\n  /// @return _recipient The proposed claim recipient.\n  /// @return _proposedAt Timestamp the proposal was stamped.\n  function pendingLeafRecipient(uint256 _chainId) external view returns (address _recipient, uint48 _proposedAt);\n\n  /// @notice The operator proposal pending for a leaf chain, if any.\n  /// @param _chainId Leaf chain to read.\n  /// @return _operator Address proposed as operator; zero when nothing is pending.\n  /// @return _proposedAt Timestamp the proposal was stamped.\n  function pendingOperator(uint256 _chainId) external view returns (address _operator, uint48 _proposedAt);\n\n  /// @notice Governance weight each holder has already spent on a proposal, bounded by their\n  ///         snapshot slice. Lives here rather than in the governance library, so relinking it\n  ///         cannot reset what a holder spent. Keyed by Governor: proposal ids hash the proposal's\n  ///         actions and not the Governor's address, so a rotation could otherwise inherit a\n  ///         colliding id's consumption.\n  /// @param _governor Governor the spend was booked against.\n  /// @param _proposalId Proposal to read.\n  /// @param _holder Holder to read.\n  /// @return _used Weight already consumed from the holder's slice for the proposal.\n  function usedGovernanceWeight(\n    address _governor,\n    uint256 _proposalId,\n    address _holder\n  ) external view returns (uint256 _used);\n\n  /// @notice Rake accrued in a token and not yet collected, held inside `accountedBalance`.\n  /// @param _token Token to read.\n  /// @return _protocol Protocol lane.\n  /// @return _allocator Allocator lane.\n  function feeAccrued(address _token) external view returns (uint128 _protocol, uint128 _allocator);\n}\n"},"V3/src/interfaces/token/IToken.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {IERC20Metadata} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';\nimport {IERC20Permit} from '@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol';\n\nimport {ITokenExtensions} from 'V3/interfaces/token/ITokenExtensions.sol';\n\n/// @title IToken\n/// @notice Complete interface for the canonical root token.\ninterface IToken is IERC20, IERC20Metadata, IERC20Permit, ITokenExtensions {}\n"},"V3/src/interfaces/voter/IVoter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol';\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {IRootMessageOrchestrator} from 'V3/interfaces/bridge/IRootMessageOrchestrator.sol';\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IMinter} from 'V3/interfaces/minter/IMinter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\nimport {IVoterCommon} from 'V3/interfaces/voter/IVoterCommon.sol';\n\n/**\n * @title IVoter\n * @notice Root-chain Voter: types, errors and external surface for spreading veNFT voting power across chains.\n *         `CHAIN0` is the idle sink where parked power earns nothing; `TOKEN0` holds burned permanent power.\n */\ninterface IVoter is IVoterCommon, IAccessControl {\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Initial holders of the root voter's governance and operational roles.\n   * @param governor Governance role holder.\n   * @param configAdmin Configuration admin role holder.\n   * @param adapterAuthority Adapter configuration role holder.\n   * @param voterConfigurer Voter configuration role holder.\n   * @param chainConfigurer Chain registration role holder.\n   * @param chainStatusAuthority Chain status role holder.\n   * @param relayDeployer Relay deployment role holder.\n   * @param nativeWithdrawer Native withdrawal role holder.\n   * @param splitterConfigurer Splitter configuration role holder.\n   */\n  struct RoleHolders {\n    address governor;\n    address configAdmin;\n    address adapterAuthority;\n    address voterConfigurer;\n    address chainConfigurer;\n    address chainStatusAuthority;\n    address relayDeployer;\n    address nativeWithdrawer;\n    address splitterConfigurer;\n  }\n\n  /**\n   * @notice Dependencies, initial role holders and message lifetimes of the root voter.\n   * @dev Dependencies may be predicted addresses; construction makes no external calls.\n   * @param orchestrator Root message orchestrator.\n   * @param votingEscrow Voting escrow providing stake state.\n   * @param minter Minter providing the emission rate.\n   * @param token Emissions token minted by the minter.\n   * @param roles Initial governance and operational role holders.\n   * @param allocationLifetime Lifetime stamped on gauge dispatches.\n   * @param messageLifetime Lifetime stamped on claim and operator dispatches.\n   */\n  struct ConstructorParams {\n    address orchestrator;\n    address votingEscrow;\n    address minter;\n    address token;\n    RoleHolders roles;\n    uint48 allocationLifetime;\n    uint48 messageLifetime;\n  }\n\n  /**\n   * @notice One chain's additive voting-power delta plus its dispatch params.\n   * @dev `allocateChains` is additive and partial and owns only the chain-level ledger; gauges are an\n   *      `allocateGauges` / `allocate` concern.\n   * @param chainId Target chain identifier; strictly ascending across the input array, `CHAIN0` absent.\n   * @param delta AERO to ADD to this chain, drawn only from CHAIN0-parked power. `0` is a refresh poke.\n   * @param gasLimit Destination gas for the leaf `handle()` call. Zero only for the in-process root-chain entry.\n   * @param value Native fee forwarded to the orchestrator. Zero only for the root-chain entry.\n   */\n  struct ChainAllocationDispatch {\n    uint256 chainId;\n    uint128 delta;\n    uint256 gasLimit;\n    uint256 value;\n  }\n\n  /**\n   * @notice One chain's gauge distribution in a composed `allocate` call, with its dispatch params.\n   * @dev `allocate` checks the list against the `allocationChainAmounts` written earlier in the same call, then\n   *      runs the `allocateGauges` core, so `DEALLOC_GAUGE` is accepted and its return cost comes from `value`.\n   * @param chainId Target chain identifier; strictly ascending across the `_gaugeDispatches` array.\n   * @param gasLimit Destination gas for the leaf `handle()` call. Zero only for the in-process root-chain entry.\n   * @param value Native fee forwarded to the orchestrator for this chain's gauge message.\n   * @param gauges Per-gauge allocations on `chainId`, strictly ascending by gauge address.\n   */\n  struct GaugeAllocationDispatch {\n    uint256 chainId;\n    uint256 gasLimit;\n    uint256 value;\n    GaugeAllocation[] gauges;\n  }\n\n  /**\n   * @notice Reward claim request and dispatch params for one chain.\n   * @param chainId Target chain identifier; strictly ascending across the input array.\n   * @param gasLimit Destination gas for the leaf `ClaimRewards` handler. Zero only for the in-process root chain.\n   * @param value Native fee forwarded to the orchestrator. Zero only for the root-chain entry.\n   * @param recipient Address that receives claimed rewards on the leaf.\n   * @param feeClaims Fee claim requests forwarded to the leaf voter.\n   * @param incentiveClaims Incentive claim requests forwarded to the leaf voter.\n   */\n  struct ClaimRewardsParams {\n    uint256 chainId;\n    uint256 gasLimit;\n    uint256 value;\n    address recipient;\n    ILeafVoter.FeeClaim[] feeClaims;\n    ILeafVoter.IncentiveClaim[] incentiveClaims;\n  }\n\n  /**\n   * @notice Per-tokenId record written on every `allocateChains`.\n   * @param committed AERO size at the last allocation; unmoved when VE `staked` grows without a new allocation.\n   * @param lastStakeEnd Stake expiry at the last allocation; `0` for a permanent stake.\n   * @param lastAllocated Timestamp of the last chain-level allocation.\n   * @param isPermanent True for a permanent stake; the permanence signal the point math reads.\n   */\n  struct TokenState {\n    uint128 committed;\n    uint48 lastStakeEnd;\n    uint48 lastAllocated;\n    bool isPermanent;\n  }\n\n  /**\n   * @notice Per-chain state read and written together along the allocate, settle and redeem pipelines.\n   * @dev Ceiling accrues the chain weight against the global scalar over each week segment, exact for permanent\n   *      and decaying stakes alike. It reads two global accumulators: `index` (the scalar summed over time) and\n   *      `timeIndex` (the scalar summed weighted by absolute unix-epoch time, doubled). A decaying segment credits\n   *      its end weight against the first plus a slope correction from the second, so an infrequently-settled\n   *      chain accrues the same as a finely-settled one. With `Σ chainWeight == totalWeight`, `Σ ceilings` tracks\n   *      the minter schedule.\n   * @param point Aggregate voting power for the chain.\n   * @param ceiling Cumulative emissions the chain may claim.\n   * @param totalRedeemed Total `TOKEN` minted for the chain via redeem. Only ever increases.\n   * @param reportedSurplus High-water mark of unused-emissions surplus reported to root. Only ever increases.\n   *        Feeds the chain's `spendSurplus` pot, clamped there to `ceiling - totalRedeemed`. May exceed that\n   *        entitlement when the accepting redeem was backed by the donated buffer.\n   * @param cumulativeSuspendedSurplus Would-be ceiling growth caught while the chain is `Suspended`. Only ever\n   *        increases. Part of the chain's `spendSurplus` pot, netted against `surplusSpent`.\n   * @param surplusSpent Cumulative surplus minted via `spendSurplus`. Only ever increases. Netted against the\n   *        chain's pot to bound further spends.\n   * @param lastIndex The chain's cursor into the global `index`, set at its last ceiling settlement.\n   * @param lastTimeIndex The chain's cursor into the global `timeIndex`, set at its last ceiling settlement.\n   * @param donatedBuffer Donated `TOKEN` held for the chain's redeems, drawn once its ceiling is exhausted.\n   * @param status Operational status of the chain.\n   */\n  struct ChainState {\n    Point point;\n    uint256 ceiling;\n    uint256 totalRedeemed;\n    uint256 reportedSurplus;\n    uint256 cumulativeSuspendedSurplus;\n    uint256 surplusSpent;\n    uint256 lastIndex;\n    uint256 lastTimeIndex;\n    uint256 donatedBuffer;\n    ChainStatus status;\n  }\n\n  /**\n   * @notice Live external state read once at the top of an allocation call, before anything is dispatched.\n   * @dev Every dispatch hands control to a caller-supplied refund address that can reenter the VotingEscrow,\n   *      outside this contract's guard; reading once keeps every message of one call on the same position.\n   * @param staked Live VE staked amount.\n   * @param stakeEnd Live VE stake expiry; `0` for a permanent stake.\n   * @param emissionRate Minter emission rate backing every root rate and payload in the call.\n   * @param isPermanent True for a permanent stake, carried through to the leaf snapshot.\n   */\n  struct AllocationSnapshot {\n    uint128 staked;\n    uint48 stakeEnd;\n    uint256 emissionRate;\n    bool isPermanent;\n  }\n\n  /**\n   * @notice Per-tokenId token and VE state read once when the allocation pipeline starts. Pipeline-local.\n   * @param veStaked Current VE-staked AERO; the cap the booked total must stay within.\n   * @param prevCommitted The token's booked total at the prior allocation.\n   * @param veStakeEnd Current stake expiry; `0` for a permanent stake.\n   * @param oldStakeEnd `tokenStates[_tokenId].lastStakeEnd` at the prior allocation.\n   * @param veIsPermanent True for the live permanent stake, shipped to the leaf snapshot and used by the point math.\n   * @param oldIsPermanent True for the stored permanent shape (`tokenStates[_tokenId].isPermanent`).\n   */\n  struct AllocationContext {\n    uint128 veStaked;\n    uint128 prevCommitted;\n    uint48 veStakeEnd;\n    uint48 oldStakeEnd;\n    bool veIsPermanent;\n    bool oldIsPermanent;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Emitted when permanent voting power parked on `TOKEN0` / `CHAIN0` is burned.\n   * @param _caller Address that triggered the burn (the VotingEscrow's default VPM).\n   * @param _amount AERO removed from `TOKEN0`'s committed and from the chain0 and total permanent balances.\n   */\n  event Burned(address indexed _caller, uint128 _amount);\n\n  /**\n   * @notice Emitted when a batch of chain0 allocation moves is mirrored from a VotingEscrow rebalance.\n   * @param _sources Source deltas drained from the chain0 ledger, as forwarded by VotingEscrow.\n   * @param _destinations Destination deltas credited to the chain0 ledger, mint sentinels already resolved.\n   */\n  event Chain0Rebalanced(IVotingEscrow.SourceDelta[] _sources, IVotingEscrow.DestinationDelta[] _destinations);\n\n  /**\n   * @notice Emitted when a cooldown reduction is dispatched to a leaf. Root keeps no reduction state.\n   * @param _tokenId veNFT id whose cooldown reduction is being dispatched.\n   * @param _chainId Destination chain the reduction applies to.\n   * @param _reduction Reduction shipped to the leaf, in seconds.\n   */\n  event CooldownReductionDispatched(uint256 indexed _tokenId, uint256 indexed _chainId, uint48 _reduction);\n\n  /**\n   * @notice Emitted when a reward claim is dispatched to a leaf.\n   * @param _tokenId veNFT id whose rewards are being claimed.\n   * @param _chainId Destination chain the reward claim targets.\n   * @param _recipient Address that receives any claimed rewards.\n   */\n  event RewardsClaimDispatched(uint256 indexed _tokenId, uint256 indexed _chainId, address indexed _recipient);\n\n  /**\n   * @notice Emitted when a `Redeem` message is processed and the recipient is paid.\n   * @param _chainId Source chain id of the processed redeem message.\n   * @param _recipient Address that received the `TOKEN`.\n   * @param _amount Amount of `TOKEN` the recipient received, minted and, past the ceiling, paid from the\n   *                chain's donated buffer.\n   * @param _surplusReported Reported surplus high-water mark recorded for the chain after the redeem.\n   */\n  event RedeemProcessed(\n    uint256 indexed _chainId, address indexed _recipient, uint256 _amount, uint256 _surplusReported\n  );\n\n  /**\n   * @notice Emitted when `TOKEN` is donated into a chain's redeem buffer.\n   * @param _chainId Chain whose donated buffer was credited.\n   * @param _donor Address the donation was pulled from.\n   * @param _amount Amount of `TOKEN` added to the buffer.\n   */\n  event Donated(uint256 indexed _chainId, address indexed _donor, uint256 _amount);\n\n  /**\n   * @notice Emitted when a redeem draws on a chain's donated buffer for the part its ceiling cannot cover.\n   * @param _chainId Chain whose donated buffer was drawn.\n   * @param _amount Amount of `TOKEN` paid out of the buffer instead of minted.\n   */\n  event BufferDrawn(uint256 indexed _chainId, uint256 _amount);\n\n  /**\n   * @notice Emitted when a `Deallocate` message is processed and the power is credited back to `CHAIN0`.\n   * @param _chainId Origin chain id the voting power was deallocated from.\n   * @param _tokenId veNFT id whose voting power was returned to `CHAIN0`.\n   * @param _amount Voting power credited to `CHAIN0`, clamped to the token's origin-chain balance.\n   */\n  event DeallocationProcessed(uint256 indexed _chainId, uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when a token owner pulls power off a `Suspended` chain via `emergencyDeallocate`.\n   * @param _chainId Chain id the voting power was pulled from.\n   * @param _tokenId veNFT id whose voting power was returned to `CHAIN0`.\n   * @param _amount Voting power credited to `CHAIN0`, equal to the token's booked balance on the chain.\n   */\n  event EmergencyDeallocated(uint256 indexed _chainId, uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when a token's chain budgets are allocated via `allocateChains` or `allocate`.\n   * @param _tokenId veNFT id whose chain allocation was applied.\n   * @param _allocations The per-chain dispatch batch; each `delta` is added to that chain's booked budget.\n   */\n  event ChainsAllocated(uint256 indexed _tokenId, ChainAllocationDispatch[] _allocations);\n\n  /**\n   * @notice Emitted when a token's gauge distribution for a chain is dispatched to the leaf.\n   * @param _tokenId veNFT id whose gauges were allocated.\n   * @param _chainId Destination chain the gauge distribution targets.\n   * @param _gauges The requested per-gauge allocation shipped to the leaf.\n   */\n  event GaugesAllocated(uint256 indexed _tokenId, uint256 indexed _chainId, GaugeAllocation[] _gauges);\n\n  /**\n   * @notice Emitted when a withdrawn token's root allocation ledger is cleared.\n   * @param _tokenId veNFT id whose ledger was cleared.\n   * @param _clearedChains Chains the token still had booked amounts on, all dropped by this call.\n   */\n  event TokenCleared(uint256 indexed _tokenId, uint256[] _clearedChains);\n\n  /**\n   * @notice Emitted when a token's unbooked voting power is parked onto `CHAIN0` via `parkOnChain0`.\n   * @param _tokenId veNFT id whose voting power was parked.\n   * @param _amount Voting power booked onto `CHAIN0`.\n   */\n  event ParkedOnChain0(uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when the gauge-message lifetime is updated.\n   * @param _allocationLifetime New lifetime in seconds, stamped onto every gauge dispatch as an absolute expiry.\n   */\n  event AllocationLifetimeSet(uint48 _allocationLifetime);\n\n  /**\n   * @notice Emitted when the claim and operator message lifetime is updated.\n   * @param _messageLifetime New lifetime in seconds, stamped onto every claim and operator dispatch as an absolute\n   *                       expiry.\n   */\n  event MessageLifetimeSet(uint48 _messageLifetime);\n\n  /**\n   * @notice Emitted when a new chain is registered.\n   * @param _chainId Newly registered chain id.\n   */\n  event ChainRegistered(uint256 indexed _chainId);\n\n  /**\n   * @notice Emitted when a chain's operational status changes.\n   * @param _chainId Chain whose status was updated.\n   * @param _status New status.\n   */\n  event ChainStatusSet(uint256 indexed _chainId, ChainStatus _status);\n\n  /**\n   * @notice Emitted when a chain's emergency-deallocation authorization switch is set.\n   * @param _chainId Chain whose switch was updated.\n   * @param _allowed `true` authorizes `emergencyDeallocate` for the current suspension.\n   */\n  event EmergencyDeallocationAllowedSet(uint256 indexed _chainId, bool _allowed);\n\n  /**\n   * @notice Emitted when a tokenId's per-chain operator is updated.\n   * @param _tokenId Token whose operator was updated.\n   * @param _chainId Chain the operator applies to.\n   * @param _operator New operator address. Zero clears the slot.\n   */\n  event OperatorSet(uint256 indexed _tokenId, uint256 indexed _chainId, address _operator);\n\n  /**\n   * @notice Emitted when governance mints accumulated surplus via `spendSurplus`.\n   * @param _chainId Chain whose surplus pot was spent.\n   * @param _recipient Address that received the minted `TOKEN`.\n   * @param _amount Amount of `TOKEN` minted from the pot.\n   */\n  event SurplusSpent(uint256 indexed _chainId, address indexed _recipient, uint256 _amount);\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Thrown when an operation requires an `Active` chain.\n   * @param _chainId Chain that is not `Active`.\n   */\n  error ChainNotActive(uint256 _chainId);\n\n  /**\n   * @notice Thrown when an operation is unavailable while a chain is `Paused`.\n   * @param _chainId Chain that is `Paused`.\n   */\n  error ChainPaused(uint256 _chainId);\n\n  /**\n   * @notice Thrown when a dispatch targets a chain that is neither `Active` nor `Sunset`.\n   * @param _chainId Chain that does not accept dispatches.\n   */\n  error ChainNotActiveOrSunset(uint256 _chainId);\n\n  /// @notice Thrown when a redeem plus the reserved surplus cannot be covered by the ceiling and donated buffer.\n  error CeilingExceeded();\n\n  /// @notice Thrown when the caller is not authorized to call the function.\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown by `allocateGauges` / `allocate` when Σ gauge `allocated` — including any `DEALLOC_GAUGE` or\n   *         explicit `ZERO_GAUGE` idle entry — does not exactly equal the token's power booked on the chain.\n   * @dev Root repeats the leaf's check, so a mis-summed vote is rejected before dispatch, not after a round trip.\n   * @param _chainId Chain whose booked allocation the gauge sum did not match.\n   */\n  error ChainAllocationMismatch(uint256 _chainId);\n\n  /**\n   * @notice Thrown by `allocate` when `_gaugeDispatches` chainIds are not strictly ascending, which also\n   *         rejects duplicates and `CHAIN0`.\n   */\n  error GaugeDispatchesNotStrictlyAscending();\n\n  /**\n   * @notice Thrown when a non-root-chain dispatch entry carries a zero `gasLimit`. The root-chain entry\n   *         (`chainId == block.chainid`) is exempt: it is forwarded in-process with no destination metering.\n   * @param _chainId Chain missing a `gasLimit`.\n   */\n  error MissingDestinationGasLimit(uint256 _chainId);\n\n  /**\n   * @notice Thrown when allocation chainIds are not strictly ascending, which also rejects duplicates and\n   *         `CHAIN0`.\n   */\n  error AllocationsNotStrictlyAscending();\n\n  /// @notice Thrown when claim chainIds are not strictly ascending, which also rejects duplicates and `CHAIN0`.\n  error ClaimRewardsParamsNotStrictlyAscending();\n\n  /// @notice Thrown when `claimRewards` is called without any per-chain params or a param contains no reward claims.\n  error EmptyClaimRewardsParams();\n\n  /// @notice Thrown by `burn` when the requested amount exceeds `tokenStates[TOKEN0].committed`.\n  error InsufficientCommitted();\n\n  /// @notice Thrown by `burn` or `rebalanceChain0` when the amount exceeds a source's chain0 allocation.\n  error InsufficientChain0Allocation();\n\n  /**\n   * @notice Thrown by `rebalanceChain0` when a destination already holding chain0 allocation has a stored\n   *         `lastStakeEnd` that differs from the live VE stake expiry.\n   * @dev Reconcile it via `allocateChains` first, otherwise its old and new entries would span two stakeEnds.\n   */\n  error DstShapeStale();\n\n  /**\n   * @notice Thrown by the standalone `allocateGauges` when the live stake shape no longer matches the stored\n   *         root shape (`lastStakeEnd`).\n   * @dev The gauge path does not re-anchor root's chain state, so a mismatch would desync leaf gauge accrual\n   *      from the ceiling. Reconcile with an empty `allocateChains(tokenId, [], recipient)` and retry.\n   */\n  error StaleShape();\n\n  /**\n   * @notice Thrown by the gauge dispatch path when the token has been withdrawn (`staked == 0`).\n   * @dev A withdrawn token holds no allocation on any chain, so its only gauge message is the empty no-op.\n   *      Blocking it stops a `{staked: 0, stakeEnd: 0}` shape from ever reaching a leaf, where it would be\n   *      mistaken for a permanent stake.\n   */\n  error StakeWithdrawn();\n\n  /// @notice Thrown by `reduceCooldown` when `msg.sender` does not pass `VotingEscrow.isAuthorizedVPM`.\n  error NotVoterPaymentsModule();\n\n  /// @notice Thrown by a VotingEscrow-only entrypoint when the caller is not the VotingEscrow.\n  error NotVotingEscrow();\n\n  /**\n   * @notice Thrown when an `allocationLifetime` below `MIN_MESSAGE_LIFETIME` is configured, a lifetime short enough\n   *         to expire gauge dispatches in transit.\n   */\n  error AllocationLifetimeTooLow();\n\n  /**\n   * @notice Thrown when an `allocationLifetime` above `MAX_MESSAGE_LIFETIME` is configured, a lifetime long enough\n   *         to push the stamped uint48 expiry toward overflow.\n   */\n  error AllocationLifetimeTooHigh();\n\n  /**\n   * @notice Thrown when a `messageLifetime` below `MIN_MESSAGE_LIFETIME` is configured, a lifetime short enough to\n   *         expire claim and operator dispatches in transit.\n   */\n  error MessageLifetimeTooLow();\n\n  /**\n   * @notice Thrown when a `messageLifetime` above `MAX_MESSAGE_LIFETIME` is configured, a lifetime long enough to\n   *         push the stamped uint48 expiry toward overflow.\n   */\n  error MessageLifetimeTooHigh();\n\n  /// @notice Thrown by `burn` when `_amount` is zero, a call that would only emit a misleading event.\n  error ZeroAmount();\n\n  /// @notice Thrown by `reduceCooldown` when the requested reduction is zero, a no-op message.\n  error ZeroReduction();\n\n  /// @notice Thrown when `clearToken` targets `TOKEN0`, which holds burned power and is not a user token.\n  error Token0NotClearable();\n\n  /// @notice Thrown when a per-chain setter is called with `CHAIN0`, whose state is fixed at construction.\n  error Chain0NotConfigurable();\n\n  /**\n   * @notice Thrown when `registerChain` is called for an already registered chain.\n   * @param _chainId Chain that was already registered.\n   */\n  error ChainAlreadyRegistered(uint256 _chainId);\n\n  /**\n   * @notice Thrown when a per-chain setter targets a chain that has not been registered.\n   * @param _chainId Chain that is not in `_chains`.\n   */\n  error ChainNotRegistered(uint256 _chainId);\n\n  /**\n   * @notice Thrown by `processRedeem` when the origin chain is `Suspended`: redeem mints on root, so it waits\n   *         for resume and the transport redelivers.\n   */\n  error RouteSuspended();\n\n  /**\n   * @notice Thrown when `emergencyDeallocate` targets a chain that is not `Suspended`.\n   * @param _chainId Chain whose status is not `Suspended`.\n   */\n  error ChainNotSuspended(uint256 _chainId);\n\n  /**\n   * @notice Thrown when `emergencyDeallocate` runs on a chain whose emergency switch is off.\n   * @dev Governance enables it per suspension via `setEmergencyDeallocationAllowed`; it resets on every suspend.\n   * @param _chainId Chain whose switch is not enabled.\n   */\n  error EmergencyDeallocationNotAllowed(uint256 _chainId);\n\n  /// @notice Thrown when `emergencyDeallocate` targets a token with nothing booked on the suspended chain.\n  error NothingToDeallocate();\n\n  /**\n   * @notice Thrown when `spendSurplus` requests more than the chain's spendable surplus.\n   * @param _chainId Chain whose pot was insufficient.\n   * @param _spendable Spendable surplus after settling the chain.\n   */\n  error InsufficientSurplus(uint256 _chainId, uint256 _spendable);\n\n  /*//////////////////////////////////////////////////////////////\n                                EXTERNAL\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Add voting power to the tokenId's chains — additive and partial, chain-level ledger only.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Each `delta` is ADDED to that chain from\n   *      CHAIN0-parked power (`Σ delta ≤ chain0Parked`, else `InsufficientChain0Allocation`); unbooked power\n   *      must pass `parkOnChain0` first, and reductions go leaf-first through `deallocate`, never here.\n   * @dev A `delta == 0` entry is a refresh poke, allowed on any Active chain even with no position there, that\n   *      makes the leaf settle its index and re-read `emissionsPerVP`. A changed stake shape re-anchors every\n   *      allocated chain locally, with no extra messages.\n   * @param _tokenId veNFT id to allocate with.\n   * @param _chainDispatches Per-chain delta + dispatch params; strictly ascending chainIds, `CHAIN0` absent.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function allocateChains(\n    uint256 _tokenId,\n    ChainAllocationDispatch[] calldata _chainDispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Distribute a tokenId's already-assigned chain budget across gauges on one chain.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Root keeps no gauge state. The cooldown lives on the\n   *      leaf, which reverts while it runs so the transport redelivers, and spends any pending reduction there.\n   * @dev Full overwrite: `_gauges` must sum to EXACTLY the chain budget (else `ChainAllocationMismatch`), idle\n   *      power is an explicit `ZERO_GAUGE` entry with no automatic backfill, and gauges left out are cleared.\n   * @dev Open while the chain is `Active` or `Sunset`. A sunset chain only accepts the lone `DEALLOC_GAUGE`\n   *      sentinel returning the whole budget; any other list, empty included, reverts `SunsetDeallocOnly`.\n   *      New power cannot enter because `allocateChains` stays closed.\n   * @dev An expired stake may only submit the lone `DEALLOC_GAUGE` sentinel returning its whole budget; any\n   *      other list reverts `StakeExpired`.\n   * @param _tokenId veNFT id to distribute gauge weight for.\n   * @param _chainId Destination chain the gauges live on.\n   * @param _gauges Per-gauge allocations, strictly ascending by address. Empty clears the token's gauge weight.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function allocateGauges(\n    uint256 _tokenId,\n    uint256 _chainId,\n    GaugeAllocation[] calldata _gauges,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Assign chain budgets and distribute gauges for a tokenId in a single call.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Phase 1 runs the `allocateChains` pipeline, phase 2\n   *      checks each gauge list against the budgets just written and runs the `allocateGauges` core, so both sets\n   *      of rules apply unchanged.\n   * @dev `msg.value` must equal `Σ _chainDispatches.value + Σ _gaugeDispatches.value`, else `UnexpectedValue`.\n   *      Every `_gaugeDispatches` chain must be registered and `Active` or `Sunset`; a `Sunset` entry only\n   *      accepts the lone `DEALLOC_GAUGE` list.\n   * @param _tokenId veNFT id to allocate with.\n   * @param _chainDispatches Per-chain delta + dispatch params; strictly ascending chainIds, `CHAIN0` absent.\n   * @param _gaugeDispatches Per-chain gauge distributions; strictly ascending chainIds, `CHAIN0` absent.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function allocate(\n    uint256 _tokenId,\n    ChainAllocationDispatch[] calldata _chainDispatches,\n    GaugeAllocationDispatch[] calldata _gaugeDispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Dispatches fee and incentive reward claims to leaf voters.\n   * @dev Approved-or-owner of `_tokenId` per `VotingEscrow`. Claim chainIds must be registered, `Active` or\n   *      `Sunset`, and strictly ascending. A non-root entry must provide destination gas. `msg.value` must equal\n   *      the sum of entry values.\n   * @dev Each payload encodes `_tokenId`, an absolute expiry of `block.timestamp + messageLifetime`, the recipient,\n   *      and both claim arrays. Fees are processed before incentives. The expiry bounds how long a stalled claim\n   *      stays executable on the leaf: the recipient is fixed at dispatch, so without it a claim held back past a\n   *      root-side token transfer could still pay the previous owner, including fees accrued after dispatch.\n   * @param _tokenId veNFT id to claim rewards for.\n   * @param _claimRewardsParams Per-chain reward claims and dispatch params.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function claimRewards(\n    uint256 _tokenId,\n    ClaimRewardsParams[] calldata _claimRewardsParams,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Donate `TOKEN` into a chain's redeem buffer, extra headroom redeems draw on once the chain's\n   *         ceiling is exhausted.\n   * @dev Permissionless. Pulls the amount from the caller, so it needs a prior approval. The buffer is tracked\n   *      next to the ceiling, never inside it: the ceiling stays pure accrued state and donated headroom stays\n   *      auditable on its own. Reverts `ChainNotRegistered` or `ZeroAmount`.\n   * @param _chainId Registered chain whose donated buffer is credited.\n   * @param _amount Amount of `TOKEN` to pull from the caller into the buffer.\n   */\n  function donate(uint256 _chainId, uint256 _amount) external;\n\n  /**\n   * @notice Inbound handler for `Redeem` messages from a leaf chain.\n   * @dev `ORCHESTRATOR` only. Applies the surplus max rule and the buffer solvency check before paying. The\n   *      part of the amount the ceiling covers is minted; any remainder is paid from the chain's donated\n   *      buffer, which keeps supply neutral for donated headroom. Reverts `CeilingExceeded` when the buffer\n   *      cannot cover the payout the ceiling headroom leaves unpaid, so the transport redelivers once accrual\n   *      or donations cover it. A surplus report may be stored past the chain's mint entitlement;\n   *      `spendableSurplus` clamps that excess out of the pot, so the buffer never funds a surplus mint.\n   * @dev A minted leg below the Minter's `MIN_MINT_AMOUNT` is paid entirely from the buffer when it can\n   *      absorb the full amount, so a sliver of headroom never stalls a covered redeem; otherwise the mint\n   *      reverts `AmountTooLow` and the transport redelivers once enough headroom accrues.\n   * @param _originChainId Source chain id of the inbound `Redeem` message.\n   * @param _amount Amount of `TOKEN` to pay the recipient.\n   * @param _recipient Address that receives the `TOKEN`.\n   * @param _surplusAccrued Surplus accumulator snapshot reported by the leaf chain.\n   */\n  function processRedeem(uint256 _originChainId, uint256 _amount, address _recipient, uint256 _surplusAccrued) external;\n\n  /**\n   * @notice Inbound handler for a `Deallocate` message: credit the power back to the token's `CHAIN0` balance\n   *         once the leaf confirms the removal.\n   * @dev `ORCHESTRATOR` only. Clamps `_amount` to the token's current origin-chain allocation, so a late or\n   *      duplicate message credits nothing, then moves it to `CHAIN0` at the stored shape and refreshes rates.\n   * @dev Carries no reentrancy guard, so a root-colocated leaf's synchronous return can land while the\n   *      allocation entrypoint that started it still holds the shared guard.\n   * @param _originChainId Origin chain id the voting power was deallocated from.\n   * @param _tokenId veNFT id whose voting power is being returned.\n   * @param _amount Voting power the leaf reports as deallocated; clamped on receipt.\n   */\n  function processDeallocation(uint256 _originChainId, uint256 _tokenId, uint128 _amount) external;\n\n  /**\n   * @notice Pull a token's booked voting power off a `Suspended` chain back to `CHAIN0`, without the leaf\n   *         confirmation that chain can no longer send, and ship the leaf a matching unwind.\n   * @dev Token owner or approved operator; `msg.value` funds the transport fee and excess is refunded. Reverts\n   *      `ChainNotSuspended`, `EmergencyDeallocationNotAllowed` (see `setEmergencyDeallocationAllowed`),\n   *      `NothingToDeallocate`, or `MissingDestinationGasLimit` on a zero `_gasLimit` for a non-root chain.\n   * @dev Full-drains at the stored shape through the same credit path as `processDeallocation`, so a later leaf\n   *      `deallocate` clamps to zero. The chain MUST NOT resume before the unwind lands — see `setChainStatus`.\n   *      A sunset chain keeps its normal exit paths; when its leaf or transport goes dark mid wind-down,\n   *      governance flips it to `Suspended` and this becomes the exit of last resort.\n   * @param _tokenId veNFT id whose voting power is being pulled back.\n   * @param _chainId Suspended chain id to pull the voting power from.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function emergencyDeallocate(\n    uint256 _tokenId,\n    uint256 _chainId,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Book a token's unbooked voting power (`staked - committed`) onto `CHAIN0`, where it earns nothing but\n   *         becomes available to chain allocations, VPM rebalances, `burn` and stake reshapes.\n   * @dev VotingEscrow only (`NotVotingEscrow`); it calls this on every deposit and on every shape change it does\n   *      not otherwise report, so the ledger mirrors the live stake. An expired stake reverts `StakeExpired`.\n   * @dev Anchors at the live `stakeEnd`, re-anchoring an older-shape position first, so it never reverts on a\n   *      stale shape. Leaves `lastAllocated` untouched, so parking never moves the cooldown anchor.\n   * @param _tokenId veNFT id whose unbooked voting power is parked.\n   */\n  function parkOnChain0(uint256 _tokenId) external;\n\n  /**\n   * @notice Drop a withdrawn token's root allocation ledger so a later revival starts from a clean slate.\n   * @dev VotingEscrow only (`NotVotingEscrow`), called from `withdraw` once the stake is zeroed. Clears\n   *      `tokenStates` and every `allocationChainAmounts` entry; `TOKEN0` reverts `Token0NotClearable`, and a\n   *      second call does nothing. A stale `lastStakeEnd` would revive the position at the wrong shape.\n   * @dev Deliberately touches no weight: the expired stake's bias already decayed to zero, so unwinding the\n   *      points would subtract twice and break `Σ per-chain == totalPoint`. No ceiling or scalar is resampled.\n   * @param _tokenId veNFT id being cleared.\n   */\n  function clearToken(uint256 _tokenId) external;\n\n  /**\n   * @notice Burn voting power parked on `TOKEN0` / `CHAIN0`.\n   * @dev `VOTING_ESCROW` only; it burns the matching accumulator stake and forwards the burn here.\n   * @param _amount AERO amount to burn from `tokenStates[TOKEN0].committed`.\n   */\n  function burn(uint128 _amount) external;\n\n  /**\n   * @notice Mirror a batch of `rebalanceUnderlying` moves onto the chain0 ledger.\n   * @dev `VOTING_ESCROW` only. Sources are drained and destinations credited independently: `rebalanceUnderlying`\n   *      conserves totals, so the per-tokenId net deltas hold however the equal totals are sliced, and a source\n   *      equal to a destination is allowed: its legs cancel out.\n   * @dev Settles chain0 and `totalPoint` once for the batch, then recomputes chain0's rate once. Stake-end\n   *      ordering is left to VotingEscrow; only `InsufficientChain0Allocation` and `DstShapeStale` are checked.\n   * @param _sources Source deltas drained from the chain0 ledger, as forwarded by VotingEscrow.\n   * @param _destinations Destination deltas credited to the chain0 ledger, mint sentinels already resolved.\n   */\n  function rebalanceChain0(\n    IVotingEscrow.SourceDelta[] calldata _sources,\n    IVotingEscrow.DestinationDelta[] calldata _destinations\n  ) external;\n\n  /**\n   * @notice Dispatch a cooldown reduction for `_tokenId` to a leaf.\n   * @dev Caller must pass `VOTING_ESCROW.isAuthorizedVPM`. `_reduction` must be non-zero, `_chainId` registered\n   *      and `Active` or `Sunset`, `_gasLimit` non-zero off the root chain; `msg.value` funds the transport fee.\n   *      Open under `Sunset` so a holder deep in cooldown can still land the exit vote before it expires.\n   * @dev Root stores nothing: the leaf accrues the reduction additively and spends it, clamped to its\n   *      `allocationCooldown`, on the next gauge allocation, so grants stack and message order does not matter.\n   * @param _tokenId veNFT id whose cooldown is being reduced.\n   * @param _chainId Destination chain the reduction applies to.\n   * @param _reduction Requested reduction in seconds, added to the leaf's pending reduction.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function reduceCooldown(\n    uint256 _tokenId,\n    uint256 _chainId,\n    uint48 _reduction,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Set the gauge-message lifetime stamped onto every gauge dispatch as an absolute expiry.\n   * @dev `VOTER_CONFIG_ROLE`. The leaf rejects an expired message with `AllocationExpired`, so a lifetime below\n   *      `MIN_MESSAGE_LIFETIME` reverts `AllocationLifetimeTooLow` here rather than expiring dispatches in transit.\n   *      A lifetime above `MAX_MESSAGE_LIFETIME` reverts `AllocationLifetimeTooHigh` so the stamped expiry can\n   *      never overflow uint48.\n   * @param _allocationLifetime New lifetime, in seconds.\n   */\n  function setAllocationLifetime(uint48 _allocationLifetime) external;\n\n  /**\n   * @notice Set the message lifetime stamped onto every claim and operator dispatch as an absolute expiry.\n   * @dev `VOTER_CONFIG_ROLE`. Bounds how long a dispatched claim or operator update stays executable on the leaf:\n   *      past the expiry the leaf drops it with `ExpiredMessageDropped`, so a stalled message cannot land after the\n   *      token changed hands on root. A lifetime below `MIN_MESSAGE_LIFETIME` reverts `MessageLifetimeTooLow` here\n   *      rather than expiring dispatches in transit. A lifetime above `MAX_MESSAGE_LIFETIME` reverts\n   *      `MessageLifetimeTooHigh` so the stamped expiry can never overflow uint48.\n   * @param _messageLifetime New lifetime, in seconds.\n   */\n  function setMessageLifetime(uint48 _messageLifetime) external;\n\n  /**\n   * @notice Register a new chain with the protocol.\n   * @dev `CHAIN_CONFIG_ROLE`. Seeds the chain's settlement cursors and sets `Active`. Reverts on `CHAIN0`, whose\n   *      state is fixed at construction, and on an already registered chain.\n   * @param _chainId Chain id to register.\n   */\n  function registerChain(uint256 _chainId) external;\n\n  /**\n   * @notice Update a registered chain's operational status.\n   * @dev `CHAIN_STATUS_ROLE`. Reverts on `CHAIN0`, unregistered chains, a `None` target and same-value writes;\n   *      `Suspended` only exits to `Active` or `Sunset`, `Sunset` only exits to `Suspended`, and entering\n   *      `Suspended` resets\n   *      `emergencyDeallocationAllowed` to `false`. Root and leaf are set independently:\n   *      suspend or sunset leaf first, resume root first, so the gap under-emits.\n   * @dev Before resuming from `Suspended`, governance MUST first switch\n   *      `setEmergencyDeallocationAllowed` off — an emergency\n   *      unwind created mid-checklist would invalidate every check below — and then confirm, in this order:\n   *      (1) every root->leaf message dispatched to the chain has landed or expired (`allocationLifetime` bounds\n   *      the gauge-vote wait) — a straggler landing after the resume can spawn a leaf `Deallocate` or reinstall\n   *      a stale pre-halt `emissionsPerVP`, while one landing before the resume is harmless;\n   *      (2) every leaf `Deallocate` the chain dispatched has been consumed by root — one consumed after a\n   *      resume-and-reallocate double-counts the power; (3) every `EmergencyDeallocate` sent during a\n   *      suspension reached the leaf — resuming early leaves the leaf budget under root.\n   * @dev Once the LEAF itself is back to `Active` (root resumes first), dispatch a zero-delta `allocateChains`\n   *      refresh poke: it restores the zeroed leaf scalar and its higher nonce outranks any straggler's rate.\n   *      Dispatched earlier, it lands masked to zero on the still-`Suspended` or still-`Sunset` leaf and spends\n   *      its nonce for nothing, leaving the chain under-emitting until another rate-bearing message arrives.\n   * @dev `Sunset` is expected to be terminal in practice; the transition out is an escape hatch. Reactivating\n   *      a sunset chain routes through `Suspended` on both sides, and the matrix enforces the first leg:\n   *      suspend the leaf (closes local `allocateGauges`, so it stops dispatching returns), suspend root\n   *      (stops dealloc dispatches, `allocateChains` already closed), reconcile leaf `Deallocated` against\n   *      root `DeallocationProcessed` until the in-flight set drains, then resume per the checklist above.\n   *      Direct `Sunset` -> `Active` would be unsafe: returns carry no expiry, so one dispatched before the\n   *      resume can land after a token re-allocates and be credited against the new booking, double-counting\n   *      that power. Suspending both sides first is what makes the in-flight set finite; waiting under\n   *      `Sunset` alone never closes it, because tokens keep dispatching new returns while you wait.\n   * @param _chainId Chain whose status is being updated.\n   * @param _status New status.\n   */\n  function setChainStatus(uint256 _chainId, ChainStatus _status) external;\n\n  /**\n   * @notice Enable or disable emergency deallocation for a registered chain.\n   * @dev `CHAIN_STATUS_ROLE`; reverts on an unregistered chain. Second gate on `emergencyDeallocate` next to the\n   *      `Suspended` requirement, and it resets to `false` on every suspend.\n   * @dev Enabling needs no drain: consuming a leaf `Deallocate` while `Suspended` is always safe, since the\n   *      clamp in `processDeallocation` meets a booking that cannot be refilled. Requiring a drain here would\n   *      also block emergencies indefinitely when the leaf->root path is down (returns carry no expiry). The\n   *      binding checklist sits on the resume instead — see `setChainStatus`.\n   * @param _chainId Chain whose switch is being set.\n   * @param _allowed `true` authorizes `emergencyDeallocate` for the current suspension.\n   */\n  function setEmergencyDeallocationAllowed(uint256 _chainId, bool _allowed) external;\n\n  /**\n   * @notice Set the per-tokenId operator for a chain and send the new value to the leaf.\n   * @dev `VOTING_ESCROW.isAuthorized(msg.sender, _tokenId)`. Reverts on `CHAIN0`, unregistered or `Paused`\n   *      chains, and a zero `_gasLimit` off the root chain. `Suspended` remains available so the owner can replace\n   *      or clear a stale operator, and `Sunset` so the operator running the local exit vote can still be rotated.\n   *      Always dispatches, so the leaf mirror stays in sync.\n   * @dev The message carries an absolute expiry of `block.timestamp + messageLifetime`; past it the leaf rejects the\n   *      update, so a stalled message cannot install an operator chosen before the token changed hands on root.\n   *      Known behavior: the leaf mirror still persists across root-side token transfers, so a new owner must\n   *      reset the operator on every leaf themselves.\n   * @param _tokenId Token whose operator is being set.\n   * @param _chainId Chain the operator applies to.\n   * @param _operator New operator address. Zero clears the slot.\n   * @param _gasLimit Destination gas budget for the leaf `handle()` call.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function setOperator(\n    uint256 _tokenId,\n    uint256 _chainId,\n    address _operator,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external payable;\n\n  /**\n   * @notice Mint accumulated surplus that would otherwise never be distributed.\n   * @dev `GOVERNANCE_ROLE`. Surplus is entitlement that never minted, so leaving it alone keeps it deflationary\n   *      and remains the default. Each chain owns one pot netted against `surplusSpent`. For `CHAIN0` the pot is\n   *      its whole ceiling, since idle power settles a ceiling nothing ever redeems. For a registered chain it is\n   *      `reportedSurplus` clamped to the remaining mint entitlement `ceiling - totalRedeemed`, plus\n   *      `cumulativeSuspendedSurplus`, both dead to redeems. The clamp keeps buffer backed report excess out of\n   *      the pot until ceiling accrual covers it.\n   * @dev Settles the chain first, so a `Suspended` chain's pending accrual and `CHAIN0`'s lazily settled ceiling\n   *      growth are spendable in the same call. Works for any registered status including `Suspended`, which is\n   *      how governance recovers surplus stranded by a suspension.\n   * @dev Never reduces redeem headroom. `processRedeem` does not read `surplusSpent`, and the pots hold value no\n   *      receipt holder can claim. The minter adds the team share on top, same as redeems, and reverts\n   *      `AmountTooLow` below `MIN_MINT_AMOUNT`.\n   * @param _chainId Chain whose surplus pot is being spent. `CHAIN0` or a registered chain.\n   * @param _amount Amount of `TOKEN` to mint from the pot.\n   * @param _recipient Address that receives the minted `TOKEN`.\n   */\n  function spendSurplus(uint256 _chainId, uint256 _amount, address _recipient) external;\n\n  /*//////////////////////////////////////////////////////////////\n                                VARIABLES\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Reserved chainId for idle voting power: it settles and swaps into `totalPoint`, but never receives\n   *         a dispatch and never redeems its ceiling.\n   * @return _chain0 The reserved idle chainId.\n   */\n  function CHAIN0() external view returns (uint256 _chain0);\n\n  /**\n   * @notice Reserved tokenId of the permanent veNFT holding burned voting power, moved there via\n   *         `rebalanceChain0` before `burn`.\n   * @return _token0 The reserved sink tokenId.\n   */\n  function TOKEN0() external view returns (uint256 _token0);\n\n  /**\n   * @notice Root-side MessageOrchestrator the Voter dispatches batched allocations through.\n   * @return _orchestrator MessageOrchestrator contract.\n   */\n  function ORCHESTRATOR() external view returns (IRootMessageOrchestrator _orchestrator);\n\n  /**\n   * @notice Minter that issues `TOKEN` on redeem and supplies the emission rate. Set at deployment, immutable.\n   * @return _minter The bound minter.\n   */\n  function MINTER() external view returns (IMinter _minter);\n\n  /**\n   * @notice The emissions token, the same token `MINTER` mints. Donations are held and paid out in it.\n   * @return _token The emissions token.\n   */\n  function TOKEN() external view returns (IERC20 _token);\n\n  /**\n   * @notice VotingEscrow the Voter reads tokenId stakes from.\n   * @return _votingEscrow VotingEscrow contract.\n   */\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /**\n   * @notice Allocated AERO per `(tokenId, chainId)`; Σ across chains equals `tokenStates(tokenId).committed`.\n   * @param _tokenId veNFT id.\n   * @param _chainId Target chain identifier.\n   * @return _allocated AERO amount allocated to the chain.\n   */\n  function allocationChainAmounts(uint256 _tokenId, uint256 _chainId) external view returns (uint128 _allocated);\n\n  /**\n   * @notice Aggregate per-chain state (point, ceiling, redeem accumulators, packed small fields).\n   * @param _chainId Target chain identifier.\n   * @return _point Aggregate voting power for the chain.\n   * @return _ceiling Cumulative emissions the chain may claim.\n   * @return _totalRedeemed Total `TOKEN` minted for the chain via redeem.\n   * @return _reportedSurplus High-water mark of unused-emissions surplus reported to root for the chain.\n   * @return _cumulativeSuspendedSurplus Would-be ceiling growth caught while the chain was `Suspended`.\n   * @return _surplusSpent Cumulative surplus minted for the chain via `spendSurplus`.\n   * @return _lastIndex The chain's cursor into the global `index` at its last ceiling settlement.\n   * @return _lastTimeIndex The chain's cursor into the global `timeIndex` at its last ceiling settlement.\n   * @return _donatedBuffer Donated `TOKEN` held for the chain's redeems, drawn once its ceiling is exhausted.\n   * @return _status Operational status of the chain.\n   */\n  function chainStates(uint256 _chainId)\n    external\n    view\n    returns (\n      Point memory _point,\n      uint256 _ceiling,\n      uint256 _totalRedeemed,\n      uint256 _reportedSurplus,\n      uint256 _cumulativeSuspendedSurplus,\n      uint256 _surplusSpent,\n      uint256 _lastIndex,\n      uint256 _lastTimeIndex,\n      uint256 _donatedBuffer,\n      ChainStatus _status\n    );\n\n  /**\n   * @notice Scheduled slope reduction at a stake expiry for a chain.\n   * @param _chainId Target chain identifier.\n   * @param _expiry Expiry timestamp.\n   * @return _slopeChange Slope reduction scheduled at `_expiry`.\n   */\n  function chainSlopeChanges(uint256 _chainId, uint48 _expiry) external view returns (int128 _slopeChange);\n\n  /**\n   * @notice Gauge-message lifetime stamped onto every gauge dispatch as an absolute expiry.\n   * @return _allocationLifetime Lifetime, in seconds.\n   */\n  function allocationLifetime() external view returns (uint48 _allocationLifetime);\n\n  /**\n   * @notice Claim and operator message lifetime stamped onto every claim and operator dispatch as an absolute expiry.\n   * @return _messageLifetime Lifetime, in seconds.\n   */\n  function messageLifetime() external view returns (uint48 _messageLifetime);\n\n  /**\n   * @notice Donated `TOKEN` held for a chain's redeems, drawn once the chain's ceiling is exhausted.\n   * @dev Convenience view over `chainStates`. Tracked next to the ceiling, never credited into it, so the\n   *      ceiling keeps tracking the minter schedule and donated headroom stays auditable on its own.\n   * @param _chainId Chain whose donated buffer is being read.\n   * @return _amount `TOKEN` available to the chain's redeems beyond its ceiling.\n   */\n  function donatedBuffer(uint256 _chainId) external view returns (uint256 _amount);\n\n  /**\n   * @notice Aggregate voting power across all chains.\n   * @return _bias Current voting power.\n   * @return _slope Rate of decay per second.\n   * @return _ts Timestamp of last resolution.\n   * @return _permanentStakeBalance Non-decaying voting power from permanent stakes.\n   */\n  function totalPoint() external view returns (int128 _bias, int128 _slope, uint48 _ts, uint128 _permanentStakeBalance);\n\n  /**\n   * @notice Global emissions accumulator: the running integral of `emissionsPerVP` over time. Every chain's\n   *         ceiling accrues off it, paired with `timeIndex` (see `ChainState`).\n   * @return _index Current accumulator value, `PRECISION`-scaled.\n   */\n  function index() external view returns (uint256 _index);\n\n  /**\n   * @notice Global time-weighted emissions accumulator: `emissionsPerVP` integrated against absolute (unix-epoch)\n   *         time, stored doubled. Paired with `index` it prices a decaying chain's ceiling exactly across a\n   *         scalar change.\n   * @return _timeIndex Current time-weighted accumulator value, doubled and `PRECISION`-scaled.\n   */\n  function timeIndex() external view returns (uint256 _timeIndex);\n\n  /**\n   * @notice Global emissions per unit voting power since the last touch, `PRECISION`-scaled\n   *         (`emissionRate * PRECISION / totalWeight`). Drives the `index` advance and is shipped to leaves.\n   * @return _emissionsPerVP The current scalar.\n   */\n  function emissionsPerVP() external view returns (uint256 _emissionsPerVP);\n\n  /**\n   * @notice Value of `index` at each week boundary the global settle has crossed.\n   * @dev Chain ceilings accrue one segment per boundary, so root partitions time exactly like the leaf's gauge\n   *      walk. A chain touched more often than its gauges are settled would otherwise accrue less than the leaf\n   *      credits, and the difference is unredeemable.\n   * @param _boundary Week-aligned timestamp.\n   * @return _index Accumulator value recorded at that boundary.\n   */\n  function indexAtBoundary(uint48 _boundary) external view returns (uint256 _index);\n\n  /**\n   * @notice Value of `timeIndex` at each week boundary the global settle has crossed.\n   * @param _boundary Week-aligned timestamp.\n   * @return _timeIndex Time-weighted accumulator value recorded at that boundary.\n   */\n  function timeIndexAtBoundary(uint48 _boundary) external view returns (uint256 _timeIndex);\n\n  /**\n   * @notice Timestamp the global accumulators were last advanced to.\n   * @return _lastGlobalSettlement The settle cursor.\n   */\n  function lastGlobalSettlement() external view returns (uint48 _lastGlobalSettlement);\n\n  /**\n   * @notice Scheduled slope reduction at a stake expiry, aggregated across chains.\n   * @param _expiry Expiry timestamp.\n   * @return _slopeChange Slope reduction scheduled at `_expiry`.\n   */\n  function totalSlopeChanges(uint48 _expiry) external view returns (int128 _slopeChange);\n\n  /*//////////////////////////////////////////////////////////////\n                                  VIEWS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Whether the route from a given chain is currently suspended. Read by\n   *         `RootMessageOrchestrator.route` before it hands an inbound payload to a typed handler.\n   * @dev Strictly `Suspended`: a `Sunset` chain returns false, since its exits stay open. Off-chain monitors\n   *      tracking a wind-down must read the chain status instead of this flag.\n   * @param _chainId Source chain id to check.\n   * @return _isSuspended Whether the route from `_chainId` is suspended.\n   */\n  function isSuspended(uint256 _chainId) external view returns (bool _isSuspended);\n\n  /**\n   * @notice Surplus currently spendable for a chain via `spendSurplus`.\n   * @dev Computed from stored values, so it is a floor rather than a quote. `CHAIN0`'s ceiling and a `Suspended`\n   *      chain's accrual lag until their next settle, and `spendSurplus` settles before checking, so the\n   *      executable amount is at least this value.\n   * @dev A registered chain's reported surplus counts only up to the remaining mint entitlement\n   *      `ceiling - totalRedeemed`. Report excess accepted against the donated buffer stays out of the pot, so\n   *      the same donated backing cannot pay a redeem and fund a surplus mint.\n   * @param _chainId Chain whose spendable surplus is being read.\n   * @return _spendable Spendable surplus for the chain.\n   */\n  function spendableSurplus(uint256 _chainId) external view returns (uint256 _spendable);\n\n  /**\n   * @notice Whether emergency deallocation is currently authorized for a chain.\n   * @dev Second gate on `emergencyDeallocate`; reset to `false` on every suspend.\n   * @param _chainId Chain to check.\n   * @return _allowed Whether `emergencyDeallocate` is authorized for `_chainId`.\n   */\n  function emergencyDeallocationAllowed(uint256 _chainId) external view returns (bool _allowed);\n\n  /**\n   * @notice Chains the tokenId currently holds a non-zero allocation on, in storage order.\n   * @dev `CHAIN0` may be present alongside cross-chain allocations.\n   * @param _tokenId veNFT id.\n   * @return _chainIds Chain ids the tokenId has allocated on.\n   */\n  function allocationChainIds(uint256 _tokenId) external view returns (uint256[] memory _chainIds);\n\n  /**\n   * @notice Chains registered via `registerChain`, in storage order. `CHAIN0` is never present.\n   * @return _chainIds Registered chain ids.\n   */\n  function chains() external view returns (uint256[] memory _chainIds);\n\n  /**\n   * @notice Whether the tokenId directs any voting power to a non-CHAIN0 chain.\n   * @param _tokenId veNFT id.\n   * @return _isAllocating True when the tokenId has non-CHAIN0 allocation.\n   */\n  function allocating(uint256 _tokenId) external view returns (bool _isAllocating);\n\n  /**\n   * @notice Per-tokenId voting record captured on the last allocation.\n   * @dev `lastStakeEnd` and `isPermanent` are anchored on every chain0 destination leg and park, seeded for a\n   *      first-time recipient, so they can be set while `lastAllocated` is still zero. Source legs read the\n   *      stored shape and never write it. `lastAllocated` moves only on a chain allocation. `TOKEN0` is seeded\n   *      permanent at deployment, mirroring the escrow accumulator.\n   * @param _tokenId veNFT id.\n   * @return _committed Committed size.\n   * @return _lastStakeEnd Stake end captured at the last allocation.\n   * @return _lastAllocated Timestamp of the last allocation.\n   * @return _isPermanent True when the stored shape is permanent.\n   */\n  function tokenStates(uint256 _tokenId)\n    external\n    view\n    returns (uint128 _committed, uint48 _lastStakeEnd, uint48 _lastAllocated, bool _isPermanent);\n}\n"},"V3/src/interfaces/gauges/IGauge.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IGauge {\n  /**\n   * @notice Emitted when the gauge collects pool fees through the VotingRewardsManager.\n   * @param _caller The address that triggered fee collection.\n   * @param _claimed0 The amount of token0 fees collected.\n   * @param _claimed1 The amount of token1 fees collected.\n   */\n  event ClaimFees(address indexed _caller, uint256 _claimed0, uint256 _claimed1);\n\n  /**\n   * @notice Emitted when an account grants or revokes claim approval for an operator\n   * @param _account The account whose approval state changed\n   * @param _operator The operator being approved or revoked\n   * @param _approved The new approval state\n   */\n  event ClaimApproval(address indexed _account, address indexed _operator, bool _approved);\n\n  /**\n   * @notice Emitted when an owner grants or revokes blanket withdrawal approval for an operator\n   * @param _owner The owner whose approval changed\n   * @param _operator The operator being approved or revoked\n   * @param _approved The new approval state\n   */\n  event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);\n\n  /**\n   * @notice Emitted when a referral's deferred emissions are claimed.\n   * @param _referral The referral address whose deferred emissions were claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   * @param _amount The deferred referral emissions paid to the recipient.\n   */\n  event ReferralEmissionsClaimed(address indexed _referral, address indexed _recipient, uint256 _amount);\n\n  /**\n   * @notice Thrown when the caller is neither the account nor an approved operator.\n   */\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a caller other than the VotingRewardsManager attempts to collect fees.\n   */\n  error NotVotingRewardsManager();\n\n  /**\n   * @notice Thrown when a zero address is supplied where a non-zero address is required.\n   */\n  error ZeroAddress();\n\n  /**\n   * @notice Deposit a staked position\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   */\n  function deposit(uint256 _lp) external;\n\n  /**\n   * @notice Deposit a staked position on behalf of an owner\n   * @dev For V2 gauges, approved MetaRouters are trusted to restrict `_owner` to the account that authorized the\n   *      routed deposit; otherwise, they could reset another account's early-unstake penalty timer.\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   * @param _owner The address credited as the staked owner\n   */\n  function depositFor(uint256 _lp, address _owner) external;\n\n  /**\n   * @notice Withdraw a staked position owned by the caller\n   * @dev Defers accrued emissions when emission minting reverts\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   */\n  function withdraw(uint256 _lp) external;\n\n  /**\n   * @notice Withdraw a staked position on behalf of an account\n   * @dev Defers accrued emissions when emission minting reverts\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   * @param _account The position owner\n   */\n  function withdrawFrom(uint256 _lp, address _account) external;\n\n  /**\n   * @notice Claim accrued and deferred emissions\n   * @dev Requires the caller to be the LP or an operator with claim approval\n   * @param _account The address of the LP staker whose emissions are being claimed\n   * @param _recipient The recipient of the claimed emissions\n   */\n  function claimEmissions(address _account, address _recipient) external;\n\n  /**\n   * @notice Claims a referral's deferred emissions.\n   * @dev Requires the caller to be the referral or an operator with claim approval.\n   * @param _referral The referral address whose deferred emissions are being claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   */\n  function claimReferralEmissions(address _referral, address _recipient) external;\n\n  /**\n   * @notice Grant or revoke an operator's approval to claim emissions on behalf of the caller\n   * @param _operator The operator to approve or revoke\n   * @param _approved True to approve, false to revoke\n   */\n  function approveForClaim(address _operator, bool _approved) external;\n\n  /**\n   * @notice Grant or revoke blanket withdrawal authorization for an operator over all staked positions\n   * @param _operator The operator to authorize or revoke\n   * @param _approved True to grant blanket approval, false to revoke\n   */\n  function setApprovalForAll(address _operator, bool _approved) external;\n\n  /**\n   * @notice Approve an operator to withdraw a staked position\n   * @param _operator The operator to authorize\n   * @param _lp A token amount for V2 gauges or an NFT token ID for CL gauges\n   */\n  function approve(address _operator, uint256 _lp) external;\n\n  /**\n   * @notice Collect currently claimable pool fees directly to the VotingRewardsManager.\n   * @dev Only callable by the VotingRewardsManager.\n   * @return _amount0 The token0 fees collected.\n   * @return _amount1 The token1 fees collected.\n   */\n  function collectFees() external returns (uint256 _amount0, uint256 _amount1);\n\n  /**\n   * @notice LeafVoter contract used for gauge settlement.\n   * @return The address of the LeafVoter.\n   */\n  function voter() external view returns (address);\n\n  /**\n   * @notice Address of the factory that created this gauge.\n   * @return The address of the gauge factory.\n   */\n  function gaugeFactory() external view returns (address);\n\n  /**\n   * @notice Address of the VotingRewardsManager contract linked to the gauge.\n   * @return The address of the VotingRewardsManager.\n   */\n  function votingRewardsManager() external view returns (address);\n\n  /**\n   * @notice Returns if gauge is linked to a legitimate pool.\n   * @return Whether the gauge is linked to a legitimate pool.\n   */\n  function isPool() external view returns (bool);\n\n  /**\n   * @notice The gauge's cursor into the LeafVoter's cumulative reward share accumulator\n   * @return The cumulative reward share at the gauge's last settlement\n   */\n  function lastCumulativeRewardShare() external view returns (uint256);\n\n  /**\n   * @notice Estimates the accrued and deferred emissions claimable by an account\n   * @dev Rewards accrued since the last settlement are an estimate\n   * @param _account The address of the LP staker\n   * @return The estimated claimable amount\n   */\n  function earned(address _account) external view returns (uint256);\n\n  /**\n   * @notice Whether an operator is approved to claim emissions on behalf of an account\n   * @param _account The account that granted the approval\n   * @param _operator The operator being queried\n   * @return True if the operator is approved\n   */\n  function approvedForClaim(address _account, address _operator) external view returns (bool);\n\n  /**\n   * @notice Deferred referral emissions stored for a referral.\n   * @param _referral The referral credited with the deferred emissions.\n   * @return The referral's deferred emissions.\n   */\n  function deferredReferralEmissions(address _referral) external view returns (uint256);\n\n  /**\n   * @notice Returns whether an operator has blanket withdrawal authorization for an owner's positions\n   * @param _owner The staked position owner\n   * @param _operator The candidate operator\n   * @return True if blanket approval is active\n   */\n  function isApprovedForAll(address _owner, address _operator) external view returns (bool);\n\n  /**\n   * @notice Return currently claimable pool fees without moving tokens or mutating state.\n   * @return _amount0 The currently pending token0 fees.\n   * @return _amount1 The currently pending token1 fees.\n   */\n  function pendingFees() external view returns (uint256 _amount0, uint256 _amount1);\n}\n"},"V3/src/interfaces/pools/ICLPool.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title ICLPool\n * @notice Concentrated-liquidity pool surface required by Metarouter swaps.\n */\ninterface ICLPool {\n  /**\n   * @notice Executes an exact-input swap for positive `_amountSpecified` or an exact-output swap for a negative one.\n   * @param _recipient Address receiving the output token.\n   * @param _zeroForOne Whether token0 is exchanged for token1.\n   * @param _amountSpecified Exact input amount or negated exact output amount.\n   * @param _sqrtPriceLimitX96 Terminal square-root-price boundary.\n   * @param _data Data forwarded to `uniswapV3SwapCallback`.\n   * @return _amount0 Signed token0 balance change of the pool.\n   * @return _amount1 Signed token1 balance change of the pool.\n   */\n  function swap(\n    address _recipient,\n    bool _zeroForOne,\n    int256 _amountSpecified,\n    uint160 _sqrtPriceLimitX96,\n    bytes calldata _data\n  ) external returns (int256 _amount0, int256 _amount1);\n\n  /**\n   * @notice Returns the pool type identifier used to validate Metarouter routes.\n   * @return _poolType Canonical CL pool type label.\n   */\n  function POOL_TYPE() external view returns (bytes32 _poolType);\n\n  /**\n   * @notice Factory that deployed the pool.\n   * @return _factory Pool factory address.\n   */\n  function factory() external view returns (address _factory);\n\n  /**\n   * @notice Pool token sorted first by address.\n   * @return _token0 First pool token.\n   */\n  function token0() external view returns (address _token0);\n\n  /**\n   * @notice Pool token sorted second by address.\n   * @return _token1 Second pool token.\n   */\n  function token1() external view returns (address _token1);\n}\n"},"V3/src/interfaces/external/IWETH.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\ninterface IWETH is IERC20 {\n  /// @notice Deposits native tokens and mints wrapped native tokens to the caller\n  function deposit() external payable;\n\n  /// @notice Burns wrapped native tokens and returns native tokens to the caller\n  /// @param _wad The amount of wrapped native tokens to unwrap\n  function withdraw(uint256 _wad) external;\n}\n"},"V3/src/interfaces/minter/IMinter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IMinter\n * @notice Root side minter interface for emission rate configuration and redeem triggered TOKEN minting.\n */\ninterface IMinter {\n  /**\n   * @notice Constructor parameters for `Minter`.\n   * @dev There is no minimum base rate. Rate-change limits round up to one unit when the calculated limit is below\n   * one unit. Deployments must use a base rate large enough that this rounding does not weaken the intended\n   * percentage limit.\n   * @param token Root token minted on redemption.\n   * @param voter Root voter authorized to call `mint` and expose the current governor.\n   * @param splitter Destination for the team rate mint share.\n   * @param operator Address authorized to update the base emission rate.\n   * @param fed Address authorized to configure the dynamic rate module, or zero when unassigned.\n   * @param migrationOpen Future migration opening. Emissions and cap accrual start at the next epoch boundary.\n   * @param initialBaseRate Initial non zero base emission rate, at most `MAX_BASE_RATE`.\n   * @param maxBaseRateChangePips Initial maximum base rate change in pips. Zero pauses base rate updates.\n   * @param baseRateUpdateCooldown Initial cooldown between accepted base rate updates.\n   * @param teamRate Initial team mint share in pips.\n   * @param maxBaseRateChangePipsCap Immutable cap for `maxBaseRateChangePips`.\n   * @param minBaseRateUpdateCooldown Immutable lower bound for `baseRateUpdateCooldown`.\n   * @param maxBaseRateUpdateCooldown Immutable upper bound for `baseRateUpdateCooldown`.\n   * @param maxBandFloorPips Immutable cap for `bandFloorPips`.\n   * @param maxBandCeilingPips Immutable cap for `bandCeilingPips`.\n   */\n  struct ConstructorParams {\n    address token;\n    address voter;\n    address splitter;\n    address operator;\n    address fed;\n    uint48 migrationOpen;\n    uint232 initialBaseRate;\n    uint24 maxBaseRateChangePips;\n    uint48 baseRateUpdateCooldown;\n    uint24 teamRate;\n    uint24 maxBaseRateChangePipsCap;\n    uint48 minBaseRateUpdateCooldown;\n    uint48 maxBaseRateUpdateCooldown;\n    uint24 maxBandFloorPips;\n    uint24 maxBandCeilingPips;\n  }\n\n  /**\n   * @notice Emitted when the operator updates the base emission rate.\n   * @param _baseRate New base emission rate.\n   */\n  event BaseRateSet(uint232 _baseRate);\n\n  /**\n   * @notice Emitted when the dynamic emission rate target changes.\n   * @dev Emitted by the dynamic rate module when it pushes a target and by the FED when disabling the module\n   * clears the target.\n   * @param _rate New dynamic emission rate target, stored raw and clamped to the band on read.\n   */\n  event DynamicRateSet(uint256 _rate);\n\n  /**\n   * @notice Emitted when governance updates the operator address.\n   * @param _operator New operator address.\n   */\n  event OperatorSet(address indexed _operator);\n\n  /**\n   * @notice Emitted when governance updates the FED address.\n   * @param _fed New FED address.\n   */\n  event FEDSet(address indexed _fed);\n\n  /**\n   * @notice Emitted when governance updates the maximum base rate change.\n   * @param _maxBaseRateChangePips New maximum base rate change in pips.\n   */\n  event MaxBaseRateChangePipsSet(uint24 _maxBaseRateChangePips);\n\n  /**\n   * @notice Emitted when governance updates the base rate update cooldown.\n   * @param _baseRateUpdateCooldown New cooldown in seconds.\n   */\n  event BaseRateUpdateCooldownSet(uint48 _baseRateUpdateCooldown);\n\n  /**\n   * @notice Emitted when governance updates the team mint share.\n   * @param _teamRate New team mint share in pips.\n   */\n  event TeamRateSet(uint24 _teamRate);\n\n  /**\n   * @notice Emitted when governance updates the dynamic rate band.\n   * @param _floorPips Maximum downward movement from base rate in pips.\n   * @param _ceilingPips Maximum upward movement from base rate in pips.\n   */\n  event RateBandSet(uint24 _floorPips, uint24 _ceilingPips);\n\n  /**\n   * @notice Emitted when the FED updates the dynamic rate module authorized to push the dynamic rate.\n   * @param _module New dynamic rate module, or zero address when unassigned.\n   */\n  event DynamicRateModuleSet(address _module);\n\n  /**\n   * @notice Emitted after a successful redeem triggered mint.\n   * @param _recipient Recipient of the redeemed amount.\n   * @param _amount Redeemed amount minted to `_recipient`.\n   * @param _splitterShare Team share minted to `SPLITTER`.\n   */\n  event Minted(address indexed _recipient, uint256 _amount, uint256 _splitterShare);\n\n  /// @notice Reverts when an address parameter that cannot be zero is zero.\n  error ZeroAddress();\n\n  /// @notice Reverts when the configured splitter is the minter contract itself.\n  error InvalidSplitter();\n\n  /// @notice Reverts when a base rate is zero.\n  error InvalidBaseRate();\n\n  /// @notice Reverts when a base rate exceeds `MAX_BASE_RATE`.\n  error BaseRateTooHigh();\n\n  /// @notice Reverts when the configured migration opening is not in the future.\n  error InvalidActivationTimestamp();\n\n  /// @notice Reverts when `teamRate` exceeds `MAXIMUM_TEAM_RATE`.\n  error TeamRateTooHigh();\n\n  /// @notice Reverts when the immutable max change cap exceeds the weekly maximum rate change.\n  error MaxBaseRateChangeCapTooHigh();\n\n  /// @notice Reverts when the immutable max change cap is zero.\n  error MaxBaseRateChangeCapTooLow();\n\n  /// @notice Reverts when `maxBaseRateChangePips` exceeds its immutable cap.\n  error MaxBaseRateChangeTooHigh();\n\n  /// @notice Reverts when the paired max change and cooldown allow excessive compounded rate movement.\n  error RateControlsTooAggressive();\n\n  /// @notice Reverts when the immutable minimum cooldown is zero.\n  error MinCooldownTooLow();\n\n  /// @notice Reverts when the minimum cooldown exceeds the maximum cooldown.\n  error InvalidCooldownRange();\n\n  /// @notice Reverts when `baseRateUpdateCooldown` is below its immutable minimum.\n  error CooldownTooLow();\n\n  /// @notice Reverts when `baseRateUpdateCooldown` exceeds its immutable maximum.\n  error CooldownTooHigh();\n\n  /// @notice Reverts when the immutable floor band cap is zero.\n  error BandFloorCapTooLow();\n\n  /// @notice Reverts when the immutable floor band cap reaches or exceeds `MAX_PIPS`, which would\n  ///         allow a zero rate.\n  error BandFloorCapTooWide();\n\n  /// @notice Reverts when the immutable ceiling band cap is zero.\n  error BandCeilingCapTooLow();\n\n  /// @notice Reverts when the immutable ceiling band cap exceeds `MAX_PIPS`.\n  error BandCeilingCapTooWide();\n\n  /// @notice Reverts when `mint` is called by any address other than `VOTER`.\n  error CallerNotVoter();\n\n  /// @notice Reverts when a mint amount is below `MIN_MINT_AMOUNT`.\n  error AmountTooLow();\n\n  /// @notice Reverts when a mint would push `emissionsMinted` above `emissionsCap`.\n  error CapExceeded();\n\n  /// @notice Reverts when a governance gated setter is called by an address without `VOTER.GOVERNANCE_ROLE`.\n  error CallerNotGovernor();\n\n  /// @notice Reverts when `operator` and `fed` would become the same address.\n  error OperatorFEDCollision();\n\n  /// @notice Reverts when the floor band exceeds `MAX_BAND_FLOOR_PIPS`.\n  error BandFloorTooWide();\n\n  /// @notice Reverts when the ceiling band exceeds `MAX_BAND_CEILING_PIPS`.\n  error BandCeilingTooWide();\n\n  /// @notice Reverts when `setBaseRate` is called by any address other than `operator`.\n  error CallerNotOperator();\n\n  /// @notice Reverts when a base rate update is attempted before `nextBaseRateUpdate`.\n  error CooldownActive();\n\n  /// @notice Reverts when a base rate update would not change the rate.\n  error SameRate();\n\n  /**\n   * @notice Reverts when a base rate update exceeds the allowed change.\n   * @dev The allowed change is `baseRate * maxBaseRateChangePips / MAX_PIPS` rounded up, so it is\n   * never zero for a non zero `maxBaseRateChangePips` and can exceed the nominal fraction at small base rates.\n   */\n  error RateChangeExceedsMax();\n\n  /// @notice Reverts when `setDynamicRateModule` is called by any address other than `fed`.\n  error CallerNotFED();\n\n  /// @notice Reverts when `setDynamicRate` is called by any address other than `dynamicRateModule`.\n  error CallerNotDynamicRateModule();\n\n  /**\n   * @notice Mints TOKEN for a redeem recipient and optionally mints the team share to `SPLITTER`.\n   * @dev Amounts below `MIN_MINT_AMOUNT` revert so a non zero team rate share cannot round down to zero. The\n   * leaf redeem entrypoint must enforce the same floor so a leaf side redeem can never be refused at settlement.\n   * @dev The recipient amount counts against the accrued emissions cap. The team share does not count against\n   * the cap because it is derived from the recipient amount and bounded separately by `MAXIMUM_TEAM_RATE`.\n   * @param _amount Amount of TOKEN to mint to the recipient.\n   * @param _recipient Recipient of the redeemed amount.\n   */\n  function mint(uint256 _amount, address _recipient) external;\n\n  /**\n   * @notice Updates the operator address. Governance only.\n   * @param _operator New operator address.\n   */\n  function setOperator(address _operator) external;\n\n  /**\n   * @notice Updates the FED address. Governance only.\n   * @param _fed New FED address, or zero address to leave the role unassigned.\n   */\n  function setFED(address _fed) external;\n\n  /**\n   * @notice Updates the maximum allowed base rate change. Governance only.\n   * @dev A zero value pauses base rate updates until governance raises it. Successful calls delay\n   * `nextBaseRateUpdate` to at least one week from the call without shortening a later deadline.\n   * @param _maxBaseRateChangePips New maximum base rate change in pips.\n   */\n  function setMaxBaseRateChangePips(uint24 _maxBaseRateChangePips) external;\n\n  /**\n   * @notice Updates the base rate update cooldown. Governance only.\n   * @dev Successful calls delay `nextBaseRateUpdate` to at least one week from the call without shortening a later\n   * deadline.\n   * @param _baseRateUpdateCooldown New cooldown in seconds.\n   */\n  function setBaseRateUpdateCooldown(uint48 _baseRateUpdateCooldown) external;\n\n  /**\n   * @notice Updates the team mint share. Governance only.\n   * @param _teamRate New team mint share in pips.\n   */\n  function setTeamRate(uint24 _teamRate) external;\n\n  /**\n   * @notice Updates the dynamic module rate band. Governance only.\n   * @dev The band is the current limit on the module's authority, not a snapshot taken at push time. Because\n   * `setDynamicRate` stores its target raw, widening the band raises the effective rate of a target already pushed\n   * and narrowing it lowers that rate, in both directions without a new module push. The cap accrues at the\n   * outgoing effective rate first, so a band change only ever applies forward.\n   * @param _floorPips Maximum downward movement from base rate in pips.\n   * @param _ceilingPips Maximum upward movement from base rate in pips.\n   */\n  function setRateBand(uint24 _floorPips, uint24 _ceilingPips) external;\n\n  /**\n   * @notice Updates the base emission rate. Operator only.\n   * @dev There is no minimum base rate. The allowed change rounds up to one unit, so a small base rate can change\n   * by more than the configured percentage.\n   * @param _newRate New non zero base emission rate, at most `MAX_BASE_RATE`.\n   */\n  function setBaseRate(uint232 _newRate) external;\n\n  /**\n   * @notice Updates the dynamic rate module authorized to push the dynamic rate. FED only.\n   * @dev Setting the module to zero accrues the cap at the outgoing effective rate, then clears `dynamicRate` so\n   * emissions fall back to `baseRate`. Replacing one non-zero module with another preserves the current target\n   * until the replacement pushes a new one.\n   * @param _module New dynamic rate module, or zero address to leave the push role unassigned.\n   */\n  function setDynamicRateModule(address _module) external;\n\n  /**\n   * @notice Accrues the emissions cap and stores a new dynamic emission rate target. Dynamic rate module only.\n   * @dev Stores `_rate` raw; the band clamp is applied on read by `emissionRate`, so a later `baseRate` or band\n   * change re-scopes the emission without another push. Setting the target to zero neutralizes the dynamic\n   * override. The cap accrues only from `ACTIVATION_TIMESTAMP`.\n   * @param _rate New dynamic emission rate target, stored raw and clamped to the band on read.\n   */\n  function setDynamicRate(uint256 _rate) external;\n\n  /**\n   * @notice Returns the emission rate read by the root voter.\n   * @dev Returns zero while `block.timestamp < ACTIVATION_TIMESTAMP`; otherwise returns the stored `dynamicRate`\n   * clamped to the band around the current `baseRate`. An unset band pins the effective rate to `baseRate`.\n   * @return _rate Zero before activation; otherwise the effective rate after band clamping.\n   */\n  function emissionRate() external view returns (uint256 _rate);\n\n  /**\n   * @notice Minimum mintable amount. Matches `MAX_PIPS` so a non zero team rate share cannot\n   *         round down to zero.\n   * @return _minMintAmount Minimum mintable amount.\n   */\n  function MIN_MINT_AMOUNT() external view returns (uint256 _minMintAmount);\n\n  /**\n   * @notice Maximum allowed team rate.\n   * @return _maximumTeamRate Maximum allowed team rate in pips.\n   */\n  function MAXIMUM_TEAM_RATE() external view returns (uint256 _maximumTeamRate);\n\n  /**\n   * @notice Maximum weekly base rate change budget.\n   * @return _maxWeeklyRateChangePips Maximum weekly base rate change in pips.\n   */\n  function MAX_WEEKLY_RATE_CHANGE_PIPS() external view returns (uint24 _maxWeeklyRateChangePips);\n\n  /**\n   * @notice Weekly natural log budget used to scale shorter cooldowns.\n   * @return _weeklyLogBudgetPips Weekly natural log budget in pips.\n   */\n  function WEEKLY_LOG_BUDGET_PIPS() external view returns (uint24 _weeklyLogBudgetPips);\n\n  /**\n   * @notice Maximum accepted base emission rate.\n   * @dev Bounds rate-dependent Minter and Voter arithmetic over the full `uint48` timestamp horizon. The effective\n   * rate is at most twice the base rate. At the minimum non-zero voting weight of one, the Voter scales that rate\n   * by `1e18`, and its time-weighted accumulator grows by at most `type(uint48).max ** 2`. The bound is therefore\n   * `floor(type(uint256).max / (2 * 1e18 * type(uint48).max ** 2))`, equal to\n   * `730750818665456651398700951213`. This remains far above any viable emission rate.\n   * @return _maxBaseRate Maximum accepted base emission rate.\n   */\n  function MAX_BASE_RATE() external view returns (uint232 _maxBaseRate);\n\n  /**\n   * @notice Root token minted on redemption.\n   * @return _token Root token address.\n   */\n  function TOKEN() external view returns (address _token);\n\n  /**\n   * @notice Root voter authorized to call `mint`.\n   * @return _voter Root voter address.\n   */\n  function VOTER() external view returns (address _voter);\n\n  /**\n   * @notice Team share splitter.\n   * @return _splitter Splitter address.\n   */\n  function SPLITTER() external view returns (address _splitter);\n\n  /**\n   * @notice Timestamp at which emissions become active.\n   * @return _activationTimestamp Emission activation timestamp.\n   */\n  function ACTIVATION_TIMESTAMP() external view returns (uint48 _activationTimestamp);\n\n  /**\n   * @notice Immutable cap for `maxBaseRateChangePips`.\n   * @return _maxBaseRateChangePipsCap Immutable max change cap.\n   */\n  function MAX_BASE_RATE_CHANGE_PIPS_CAP() external view returns (uint24 _maxBaseRateChangePipsCap);\n\n  /**\n   * @notice Immutable minimum cooldown.\n   * @return _minBaseRateUpdateCooldown Minimum base rate update cooldown.\n   */\n  function MIN_BASE_RATE_UPDATE_COOLDOWN() external view returns (uint48 _minBaseRateUpdateCooldown);\n\n  /**\n   * @notice Immutable maximum cooldown.\n   * @return _maxBaseRateUpdateCooldown Maximum base rate update cooldown.\n   */\n  function MAX_BASE_RATE_UPDATE_COOLDOWN() external view returns (uint48 _maxBaseRateUpdateCooldown);\n\n  /**\n   * @notice Immutable floor band cap.\n   * @return _maxBandFloorPips Maximum floor band in pips.\n   */\n  function MAX_BAND_FLOOR_PIPS() external view returns (uint24 _maxBandFloorPips);\n\n  /**\n   * @notice Immutable ceiling band cap.\n   * @return _maxBandCeilingPips Maximum ceiling band in pips.\n   */\n  function MAX_BAND_CEILING_PIPS() external view returns (uint24 _maxBandCeilingPips);\n\n  /**\n   * @notice Current base emission rate.\n   * @return _baseRate Base emission rate.\n   */\n  function baseRate() external view returns (uint232 _baseRate);\n\n  /**\n   * @notice Current operator address.\n   * @return _operator Operator address.\n   */\n  function operator() external view returns (address _operator);\n\n  /**\n   * @notice Timestamp at which the next base rate update can execute.\n   * @return _nextBaseRateUpdate Next accepted base rate update timestamp.\n   */\n  function nextBaseRateUpdate() external view returns (uint48 _nextBaseRateUpdate);\n\n  /**\n   * @notice Current FED address.\n   * @return _fed FED address.\n   */\n  function fed() external view returns (address _fed);\n\n  /**\n   * @notice Current base rate update cooldown.\n   * @return _baseRateUpdateCooldown Base rate update cooldown.\n   */\n  function baseRateUpdateCooldown() external view returns (uint48 _baseRateUpdateCooldown);\n\n  /**\n   * @notice Current maximum base rate change.\n   * @return _maxBaseRateChangePips Maximum base rate change in pips.\n   */\n  function maxBaseRateChangePips() external view returns (uint24 _maxBaseRateChangePips);\n\n  /**\n   * @notice Current team mint share.\n   * @return _teamRate Team mint share in pips.\n   */\n  function teamRate() external view returns (uint24 _teamRate);\n\n  /**\n   * @notice Current floor band.\n   * @return _bandFloorPips Floor band in pips.\n   */\n  function bandFloorPips() external view returns (uint24 _bandFloorPips);\n\n  /**\n   * @notice Current ceiling band.\n   * @return _bandCeilingPips Ceiling band in pips.\n   */\n  function bandCeilingPips() external view returns (uint24 _bandCeilingPips);\n\n  /**\n   * @notice Current dynamic rate module authorized to push the dynamic rate.\n   * @return _dynamicRateModule Dynamic rate module address.\n   */\n  function dynamicRateModule() external view returns (address _dynamicRateModule);\n\n  /**\n   * @notice Current dynamic emission rate target, stored raw before band clamping. Zero means no target is in\n   * effect and the emission rate is the base rate.\n   * @return _dynamicRate Stored dynamic emission rate target.\n   */\n  function dynamicRate() external view returns (uint256 _dynamicRate);\n\n  /**\n   * @notice Cumulative recipient emissions cap accrued as of `lastCapUpdate`.\n   * @dev Not re-accrued on read, so it lags the live value by the segment since `lastCapUpdate`; `mint` accrues the\n   * elapsed segment before checking `emissionsMinted` against it, so the cap is exact at mint time.\n   * @return _emissionsCap Accrued emissions cap.\n   */\n  function emissionsCap() external view returns (uint256 _emissionsCap);\n\n  /**\n   * @notice Timestamp the emissions cap was last accrued. Initialized to `ACTIVATION_TIMESTAMP`.\n   * @return _lastCapUpdate Last cap accrual timestamp.\n   */\n  function lastCapUpdate() external view returns (uint48 _lastCapUpdate);\n\n  /**\n   * @notice Total TOKEN minted to redeem recipients, excluding team shares.\n   * @return _emissionsMinted Cumulative recipient minting.\n   */\n  function emissionsMinted() external view returns (uint256 _emissionsMinted);\n}\n"},"V3/src/interfaces/gauges/ICLGauge.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title ICLGauge\n * @notice Minimal concentrated-liquidity gauge surface consumed by the Metarouter staking and claim commands.\n * @dev Minimal ABI-compatible slice of the Solidity 0.7.6 `ICLGauge` interface maintained in `metadex-slipstream`.\n */\ninterface ICLGauge {\n  /**\n   * @notice Claims emissions for selected positions belonging to an account.\n   * @param _account Account whose position emissions are claimed.\n   * @param _recipient Address receiving the emissions.\n   * @param _tokenIds Positions to claim, bounding the gauge's iteration to this caller-selected set.\n   */\n  function claimEmissions(address _account, address _recipient, uint256[] calldata _tokenIds) external;\n\n  /**\n   * @notice First token of the pool the gauge incentivizes.\n   * @return _token0 The pool's `token0`.\n   */\n  function token0() external view returns (address _token0);\n\n  /**\n   * @notice Second token of the pool the gauge incentivizes.\n   * @return _token1 The pool's `token1`.\n   */\n  function token1() external view returns (address _token1);\n}\n"},"V3/src/interfaces/gauges/IV2Gauge.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\n\ninterface IV2Gauge is IGauge {\n  /**\n   * @notice Emitted when staking tokens are deposited into the gauge.\n   * @param _caller The address that supplied the staking tokens.\n   * @param _account The account credited with the deposited stake.\n   * @param _amount The amount of staking tokens deposited.\n   */\n  event Deposit(address indexed _caller, address indexed _account, uint256 _amount);\n\n  /**\n   * @notice Emitted when staking tokens are withdrawn from the gauge.\n   * @param _caller The address that initiated the withdrawal.\n   * @param _account The account whose staked balance was debited.\n   * @param _amount The amount of staking tokens withdrawn.\n   */\n  event Withdraw(address indexed _caller, address indexed _account, uint256 _amount);\n\n  /**\n   * @notice Emitted when accrued emissions are claimed.\n   * @param _account The address of the LP staker whose emissions were claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   * @param _rewardAmount The amount of emissions paid to the recipient.\n   */\n  event EmissionsClaimed(address indexed _account, address indexed _recipient, uint256 _rewardAmount);\n\n  /**\n   * @notice Emitted when accrued emissions are stored instead of claimed during withdrawal.\n   * @param _account The account credited with the deferred emissions.\n   * @param _rewardAmount The post-penalty, post-referral emissions added to the account's deferred balance.\n   */\n  event EmissionsDeferred(address indexed _account, uint256 _rewardAmount);\n\n  /**\n   * @notice Emitted when an account's referral emissions are stored for a later claim.\n   * @param _account The address of the LP staker whose emissions paid the referral.\n   * @param _referral The referral address credited with the emissions.\n   * @param _amount The referral emissions added to the referral's deferred balance.\n   */\n  event ReferralEmissionsDeferred(address indexed _account, address indexed _referral, uint256 _amount);\n\n  /**\n   * @notice Emitted when an account's deferred emissions are claimed.\n   * @param _account The account whose deferred emissions were claimed.\n   * @param _recipient The recipient of the claimed emissions.\n   * @param _amount The deferred emissions paid to the recipient.\n   */\n  event DeferredEmissionsClaimed(address indexed _account, address indexed _recipient, uint256 _amount);\n\n  /**\n   * @notice Emitted when an early withdrawal penalty is applied to an account's accrued emissions.\n   * @param _account The address of the LP staker whose emissions were penalized.\n   * @param _penalty The amount of emissions forfeited as the penalty.\n   */\n  event EarlyWithdrawPenalty(address indexed _account, uint256 _penalty);\n\n  /**\n   * @notice Emitted when an owner sets a withdrawal allowance for an operator.\n   * @param _owner The owner granting the allowance.\n   * @param _operator The operator being granted the allowance.\n   * @param _amount The new allowance amount.\n   */\n  event Approval(address indexed _owner, address indexed _operator, uint256 _amount);\n\n  /**\n   * @notice Thrown when a caller other than the voter attempts to settle rewards.\n   */\n  error NotVoter();\n\n  /**\n   * @notice Thrown when a zero amount is supplied where a non-zero amount is required.\n   */\n  error ZeroAmount();\n\n  /**\n   * @notice Thrown when initializing an already initialized gauge.\n   */\n  error AlreadyInitialized();\n\n  /**\n   * @notice Thrown when an operator's withdrawal allowance is below the requested amount.\n   */\n  error InsufficientAllowance();\n\n  /**\n   * @notice Thrown when depositing for another account while early unstake penalties are active.\n   */\n  error PenaltyActive();\n\n  /**\n   * @notice Initializes clone-specific gauge state.\n   * @param _stakingToken Address of the pool LP token or staking token.\n   * @param _votingRewardsManager Address of the VotingRewardsManager.\n   * @param _isPool Whether the staking token is a V2 pool.\n   */\n  function initialize(address _stakingToken, address _votingRewardsManager, bool _isPool) external;\n\n  /**\n   * @notice Returns whether an account is inside its configured early withdrawal penalty window\n   * @dev Uses the gauge's block source and effective config, independently of accrued rewards or balance\n   * @param _account The address of the LP staker\n   * @return Whether the penalty window is active\n   */\n  function isPenaltyActive(address _account) external view returns (bool);\n\n  /**\n   * @notice The reward-per-token accumulator projected to this block, without a claim.\n   * @dev `rewardPerTokenStored` plus the LeafVoter's projected delta since this gauge's cursor,\n   *      folded over the current supply. With no stakers the stored value is returned as is.\n   * @return _rewardPerToken The projected accumulator.\n   */\n  function projectedRewardPerToken() external view returns (uint256 _rewardPerToken);\n\n  /**\n   * @notice Address of the pool LP token which is deposited (staked) for rewards.\n   * @return The address of the staking token.\n   */\n  function stakingToken() external view returns (address);\n\n  /**\n   * @notice Stored reward-per-token accumulator.\n   * @return The accumulated emissions per staked token.\n   */\n  function rewardPerTokenStored() external view returns (uint256);\n\n  /**\n   * @notice Amount of stakingToken deposited for rewards.\n   * @return The total amount of staking tokens deposited for rewards.\n   */\n  function totalSupply() external view returns (uint256);\n\n  /**\n   * @notice Get the amount of stakingToken deposited by an account.\n   * @param _account The address of the LP staker.\n   * @return The account's deposited staking token balance.\n   */\n  function balanceOf(address _account) external view returns (uint256);\n\n  /**\n   * @notice Returns the block number at which an account most recently deposited\n   * @param _account The address of the LP staker\n   * @return The deposit block for the account\n   */\n  function depositBlock(address _account) external view returns (uint256);\n\n  /**\n   * @notice Cached rewardPerTokenStored for an account based on their most recent action.\n   * @param _account The address of the LP staker.\n   * @return The account's cached reward-per-token value.\n   */\n  function userRewardPerTokenPaid(address _account) external view returns (uint256);\n\n  /**\n   * @notice Cached amount of emissions earned for an account.\n   * @param _account The address of the LP staker.\n   * @return The account's cached earned emissions.\n   */\n  function rewards(address _account) external view returns (uint256);\n\n  /**\n   * @notice Deferred post-penalty, post-referral emissions stored for an account.\n   * @param _account The account credited with the deferred emissions.\n   * @return The account's deferred emissions.\n   */\n  function deferredEmissions(address _account) external view returns (uint256);\n\n  /**\n   * @notice Remaining withdrawal allowance an owner has granted to an operator.\n   * @param _owner The owner that granted the allowance.\n   * @param _operator The operator being queried.\n   * @return The remaining withdrawal allowance.\n   */\n  function allowance(address _owner, address _operator) external view returns (uint256);\n}\n"},"V3/src/interfaces/voter/ILeafVoter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol';\n\nimport {ILeafMessageOrchestrator} from 'V3/interfaces/bridge/ILeafMessageOrchestrator.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IReceiptTokenExtensions as IReceiptToken} from 'V3/interfaces/token/IReceiptTokenExtensions.sol';\nimport {IVoterCommon} from 'V3/interfaces/voter/IVoterCommon.sol';\n\n/**\n * @title ILeafVoter\n * @notice Leaf-chain Voter: turns per-chain reward rates and per-tokenId allocations into per-gauge emission\n *         rates, and exposes the claim surface for gauges and the redeem surface for `ReceiptToken` holders.\n * @dev Root drives two paths through the Leaf MessageOrchestrator: `applyChainAllocation` sets the chain budget\n *      and emissions scalar (no cooldown), `applyGaugeAllocations` spreads it over gauges (cooldown per chain).\n * @dev An operator drives local redistributions through `allocateGauges`. Settlement state advances lazily.\n */\ninterface ILeafVoter is IVoterCommon, IAccessControl {\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Operational roles and fee collection gas initialized with the voter.\n   * @dev Zero operational holders leave their role unassigned. A nonzero bootstrap admin holds only the\n   *      factory registry and module admin roles while later deployment units register their components.\n   * @param voterConfigurer Initial voter configuration role holder.\n   * @param tokenWhitelister Initial token whitelist role holder.\n   * @param chainStatusAuthority Initial chain status role holder.\n   * @param factoryRegistryAdmin Initial factory registry admin role holder.\n   * @param moduleAdmin Initial module admin role holder.\n   * @param gasConfigurer Initial gas configuration role holder.\n   * @param nativeWithdrawer Initial native withdrawal role holder.\n   * @param bootstrapAdmin Temporary factory registry and module admin role holder, or zero.\n   * @param collectFeesGasLimit Gas forwarded when a rewards manager collects gauge fees.\n   */\n  struct InitialConfiguration {\n    address voterConfigurer;\n    address tokenWhitelister;\n    address chainStatusAuthority;\n    address factoryRegistryAdmin;\n    address moduleAdmin;\n    address gasConfigurer;\n    address nativeWithdrawer;\n    address bootstrapAdmin;\n    uint256 collectFeesGasLimit;\n  }\n\n  /**\n   * @notice Dependencies, authorities and static configuration seeded during voter deployment.\n   * @param governor Initial governance role holder.\n   * @param configAdmin Initial configuration admin role holder.\n   * @param leafMessageOrchestrator Local messaging orchestrator.\n   * @param receiptToken Receipt token burned when emissions are redeemed.\n   * @param factoryRegistry Registry resolving gauge factories and rewards.\n   * @param gaugeManager Manager authorized to register and activate gauges.\n   * @param allocationCooldown Minimum duration between local allocations.\n   * @param minIncentiveDuration Minimum duration for incentive programs.\n   * @param maxGauges Maximum gauges in a local allocation.\n   * @param adapterAuthority Initial transport configuration role holder.\n   * @param emissionsHandler Handler delivering minted emissions.\n   * @param emergencyCouncil Initial emergency authority.\n   * @param initialConfiguration Operational holders, registration bootstrap admin and fee collection gas.\n   */\n  struct ConstructorParams {\n    address governor;\n    address configAdmin;\n    address leafMessageOrchestrator;\n    address receiptToken;\n    address factoryRegistry;\n    address gaugeManager;\n    uint48 allocationCooldown;\n    uint48 minIncentiveDuration;\n    uint256 maxGauges;\n    address adapterAuthority;\n    address emissionsHandler;\n    address emergencyCouncil;\n    InitialConfiguration initialConfiguration;\n  }\n\n  /**\n   * @notice Per-gauge settlement state, kept in one mapping so `_settleGauge` touches contiguous slots.\n   * @param ceiling Cumulative effective share credited to the gauge; only ever increases.\n   * @param claimed Cumulative emissions minted by claims; only ever increases, capped at `ceiling - surplus`.\n   * @param lastSettlement Timestamp of this gauge's last settlement.\n   * @param isRegistered Produced by an approved factory; gates routing and makes `settleGauge` a no-op if unset.\n   * @param isActivated Registered gauges start inactive and route as unregistered until this flips.\n   * @param surplus Cumulative forfeited surplus, clamped per report; `ceiling >= claimed + surplus` always holds.\n   * @param lastIndex Chain `index` at this gauge's last settlement.\n   * @param lastTimeIndex Chain `timeIndex` at this gauge's last settlement.\n   * @param point Decaying weight, resolved through `gaugeSlopeChanges` during settlement.\n   */\n  struct GaugeState {\n    uint128 ceiling;\n    uint128 claimed;\n    uint48 lastSettlement;\n    bool isRegistered;\n    bool isActivated;\n    uint128 surplus;\n    uint256 lastIndex;\n    uint256 lastTimeIndex;\n    Point point;\n  }\n\n  /**\n   * @notice Packed per-tokenId allocation state; the gating fields share one slot.\n   * @param operator Address authorized to run the local `allocateGauges` for this tokenId.\n   * @param lastAllocated Timestamp of the last allocation; the cooldown counts from here.\n   * @param canVoteForZeroCapGauges Whether the tokenId may route weight onto activated gauges whose emission\n   *                                cap is zero.\n   * @param chainAllocation Chain budget the tokenId may distribute, from its last root allocation.\n   */\n  struct TokenState {\n    address operator;\n    uint48 lastAllocated;\n    bool canVoteForZeroCapGauges;\n    uint128 chainAllocation;\n  }\n\n  /**\n   * @notice Per-gauge checkpoint entry returned by `_processAllocation` to drive the reward checkpoint.\n   * @dev Self-contained: checkpoints are external calls in a loop, so storage is not re-read between them.\n   * @dev `ZERO_GAUGE` never appears in the array.\n   * @param gauge Gauge this entry checkpoints.\n   * @param allocated Allocation checkpointed against, captured at record time so reentrancy cannot change it.\n   * @param data Opaque payload for the reward checkpoint; empty when the entry only clears a position (zero).\n   */\n  struct CheckpointData {\n    address gauge;\n    uint128 allocated;\n    bytes data;\n  }\n\n  /**\n   * @notice Fee claim request forwarded through the LeafVoter.\n   * @param votingRewardsManager VotingRewardsManager to claim fees from.\n   * @param maxCheckpoints Maximum number of user checkpoints to process.\n   */\n  struct FeeClaim {\n    address votingRewardsManager;\n    uint256 maxCheckpoints;\n  }\n\n  /**\n   * @notice Incentive claim request forwarded through the LeafVoter.\n   * @param votingRewardsManager VotingRewardsManager to claim incentives from.\n   * @param programId Incentive program ID to claim from.\n   * @param maxCheckpoints Maximum number of user checkpoints to process.\n   */\n  struct IncentiveClaim {\n    address votingRewardsManager;\n    uint256 programId;\n    uint256 maxCheckpoints;\n  }\n\n  /**\n   * @notice Mutable context threaded by memory reference through one `_processAllocation` pass.\n   * @param tokenId The tokenId being processed.\n   * @param oldSnapshot Token state at entry; unwinds resolve against its `stakeEnd`.\n   * @param newSnapshot Incoming token state; applies resolve against its `stakeEnd`.\n   * @param expired True when the new stake already expired at `lastSettlement`; skips the apply side.\n   * @param canVoteForZeroCapGauges Read once from the token state; lets `_processGauge` skip the emission cap\n   *                                gate instead of redirecting the weight to `ZERO_GAUGE`.\n   * @param list Result entries, sized to the union upper bound and trimmed at return.\n   * @param entryCount Number of entries written to `list` so far.\n   * @param bookedAmount Weight actually booked on real gauges; everything else parks on `ZERO_GAUGE`.\n   * @param deallocAmount Weight routed to `DEALLOC_GAUGE`, returned to root after the pass; never persisted.\n   */\n  struct AllocationContext {\n    uint256 tokenId;\n    TokenSnapshot oldSnapshot;\n    TokenSnapshot newSnapshot;\n    bool expired;\n    bool canVoteForZeroCapGauges;\n    CheckpointData[] list;\n    uint256 entryCount;\n    uint128 bookedAmount;\n    uint128 deallocAmount;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Emitted when the gas limit used to flush gauge fees is set.\n   * @param _gasLimit New gas limit shared by this chain's reward managers.\n   */\n  event CollectFeesGasLimitSet(uint256 _gasLimit);\n\n  /**\n   * @notice Emitted when a gauge completes a claim through `mintEmissions`.\n   * @param _gauge Gauge that invoked `mintEmissions`.\n   * @param _recipients Recipients passed by the gauge, typically the LP and the referral leg.\n   * @param _amounts Per-leg amounts of `ReceiptToken` allocated to each recipient.\n   */\n  event EmissionsMinted(address indexed _gauge, address[] _recipients, uint128[] _amounts);\n\n  /**\n   * @notice Emitted when `ReceiptToken` is redeemed and the `Redeem` message is dispatched to root.\n   * @param _redeemer Address whose `ReceiptToken` was burned.\n   * @param _recipient Address that receives the minted `TOKEN` on root.\n   * @param _amount Amount burned, equal to the `TOKEN` to mint on root.\n   */\n  event Redeemed(address indexed _redeemer, address indexed _recipient, uint256 _amount);\n\n  /**\n   * @notice Emitted when a fee claim targets an unregistered VotingRewardsManager and the LeafVoter continues.\n   * @param _tokenId The veNFT token ID whose fee claim failed.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the failed fee claim.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the failed fee claim.\n   */\n  event FeeClaimFailed(uint256 indexed _tokenId, address indexed _votingRewardsManager, uint256 _maxCheckpoints);\n\n  /**\n   * @notice Emitted when a forwarded fee claim completes without reverting.\n   * @param _tokenId The veNFT token ID whose fee claim succeeded.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the successful fee claim.\n   * @param _recipient Address that received any claimed fees.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the fee claim.\n   */\n  event FeeClaimSucceeded(\n    uint256 indexed _tokenId, address indexed _votingRewardsManager, address indexed _recipient, uint256 _maxCheckpoints\n  );\n\n  /**\n   * @notice Emitted when an incentive claim targets an unregistered VotingRewardsManager and the LeafVoter continues.\n   * @param _tokenId The veNFT token ID whose incentive claim failed.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the failed incentive claim.\n   * @param _programId Incentive program ID whose claim failed.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the failed incentive claim.\n   */\n  event IncentiveClaimFailed(\n    uint256 indexed _tokenId, address indexed _votingRewardsManager, uint256 indexed _programId, uint256 _maxCheckpoints\n  );\n\n  /**\n   * @notice Emitted when a forwarded incentive claim completes without reverting.\n   * @param _tokenId The veNFT token ID whose incentive claim succeeded.\n   * @param _votingRewardsManager VotingRewardsManager targeted by the successful incentive claim.\n   * @param _programId Incentive program ID whose claim succeeded.\n   * @param _recipient Address that received any claimed incentives.\n   * @param _maxCheckpoints Maximum number of user checkpoints requested for the incentive claim.\n   */\n  event IncentiveClaimSucceeded(\n    uint256 indexed _tokenId,\n    address indexed _votingRewardsManager,\n    uint256 indexed _programId,\n    address _recipient,\n    uint256 _maxCheckpoints\n  );\n\n  /**\n   * @notice Emitted when a token's parked `DEALLOC_GAUGE` balance is drained and sent back to root.\n   * @param _tokenId veNFT id whose parked voting power was deallocated.\n   * @param _amount Voting power returned to root's `CHAIN0`.\n   */\n  event Deallocated(uint256 indexed _tokenId, uint128 _amount);\n\n  /**\n   * @notice Emitted when an `EmergencyDeallocate` message re-syncs a token's position with root.\n   * @param _tokenId veNFT id whose position on the chain was reduced.\n   */\n  event EmergencyDeallocationApplied(uint256 indexed _tokenId);\n\n  /**\n   * @notice Emitted when a gauge's settlement cursor advances.\n   * @dev Shares cover the entire settled interval, summed across its weekly segments. Already settled gauges\n   *      emit nothing. `ZERO_GAUGE` has a zero cap and credits its entire allocated share to surplus.\n   * @param _gauge Gauge whose accrued emissions were settled.\n   * @param _effectiveShare Emissions credited to the gauge during this settlement, in raw TOKEN units.\n   * @param _surplusDelta Cap excess added to the chain surplus during this settlement, in raw TOKEN units.\n   * @param _cap Resolved per-second emission cap used throughout the settlement, in raw TOKEN units.\n   * @param _gaugeWeight Voting power at the settlement timestamp after any defensive clamp, before allocation changes.\n   */\n  event GaugeCapSettled(\n    address indexed _gauge, uint128 _effectiveShare, uint128 _surplusDelta, uint128 _cap, uint256 _gaugeWeight\n  );\n\n  /**\n   * @notice Emitted when `_walkGauge` clamps a sub-zero resolved weight; signals an ordering or arithmetic bug.\n   * @param _gauge The gauge whose resolved weight underflowed.\n   * @param _detectedWeight The negative resolved weight seen before clamping.\n   */\n  event GaugeWeightClamped(address indexed _gauge, int256 _detectedWeight);\n\n  /**\n   * @notice Emitted when a registered gauge forfeits surplus emissions it cannot distribute.\n   * @param _gauge The gauge that forfeited the surplus.\n   * @param _amount Surplus accrued after clamping, which may be less than the reported amount.\n   */\n  event EmissionsForfeited(address indexed _gauge, uint128 _amount);\n\n  /**\n   * @notice Emitted when the leaf message orchestrator updates a tokenId's operator.\n   * @param _tokenId The tokenId whose operator was updated.\n   * @param _operator The new operator address.\n   */\n  event OperatorSet(uint256 indexed _tokenId, address indexed _operator);\n\n  /**\n   * @notice Emitted when a `ReduceCooldown` message accrues a tokenId's cooldown reduction.\n   * @param _tokenId The tokenId whose accumulated cooldown reduction increased.\n   * @param _reduction Seconds added by this message.\n   * @param _accumulated New total in seconds, clamped at `maxAccumulatedCooldownReduction`.\n   */\n  event CooldownReductionApplied(uint256 indexed _tokenId, uint48 _reduction, uint48 _accumulated);\n\n  /**\n   * @notice Emitted when a tokenId's can-vote-for-zero-cap-gauges flag is updated.\n   * @param _tokenId The tokenId whose flag was updated.\n   * @param _allowed The new flag value.\n   */\n  event CanVoteForZeroCapGaugesSet(uint256 indexed _tokenId, bool _allowed);\n\n  /**\n   * @notice Emitted when the local-voting master switch is set.\n   * @param _enabled True once local `allocateGauges` is open.\n   */\n  event LocalVotingEnabledSet(bool _enabled);\n\n  /**\n   * @notice Emitted when the local allocation cooldown is updated.\n   * @param _allocationCooldown The new cooldown duration in seconds.\n   */\n  event AllocationCooldownSet(uint48 _allocationCooldown);\n\n  /**\n   * @notice Emitted when the per-chain gauge-count cap is updated.\n   * @param _maxGauges The new cap on gauges a tokenId may allocate to locally.\n   */\n  event MaxGaugesSet(uint256 _maxGauges);\n\n  /**\n   * @notice Emitted when the cap on a tokenId's accumulated cooldown reduction is updated.\n   * @param _maxAccumulatedCooldownReduction New accumulation cap, in seconds.\n   */\n  event MaxAccumulatedCooldownReductionSet(uint48 _maxAccumulatedCooldownReduction);\n\n  /**\n   * @notice Emitted when the minimum incentive duration is updated.\n   * @param _minIncentiveDuration The new minimum duration in seconds.\n   */\n  event MinIncentiveDurationSet(uint48 _minIncentiveDuration);\n\n  /**\n   * @notice Emitted when the chain's operational status is updated.\n   * @param _status The new chain status.\n   */\n  event ChainStatusSet(ChainStatus _status);\n\n  /**\n   * @notice Emitted when a chain-allocation message is applied for a tokenId.\n   * @param _tokenId The tokenId whose chain budget was updated.\n   * @param _allocationDelta Additive delta this message applied (may be zero on a resync).\n   * @param _chainAllocation The resulting chain budget.\n   * @param _emissionsPerVP Stored scalar after the call, `PRECISION`-scaled; zero while `Suspended`.\n   */\n  event ChainAllocated(\n    uint256 indexed _tokenId, uint128 _allocationDelta, uint128 _chainAllocation, uint256 _emissionsPerVP\n  );\n\n  /**\n   * @notice Emitted when a tokenId's gauge distribution is applied, locally or bridged.\n   * @param _tokenId The tokenId whose gauges were allocated.\n   * @param _allocations Requested allocation; unroutable gauges may be redirected, so booked weight can differ.\n   * @param _emissionsPerVP Stored scalar after the call, `PRECISION`-scaled; zero while `Suspended`.\n   */\n  event GaugesAllocated(uint256 indexed _tokenId, GaugeAllocation[] _allocations, uint256 _emissionsPerVP);\n\n  /**\n   * @notice Emitted when a gauge is registered, active or not.\n   * @param gauge The registered gauge.\n   * @param activated Whether the gauge activated at registration.\n   * @param registrationCursor The chain `lastSettlement` the gauge's\n   *                           settlement cursor was seeded from.\n   */\n  event GaugeRegistered(address indexed gauge, bool activated, uint48 registrationCursor);\n\n  /**\n   * @notice Emitted when a gauge is activated, either at registration or\n   *         through delayed activation.\n   * @param gauge The activated gauge.\n   * @param activationCursor The effective activation cursor, the chain\n   *                         `lastSettlement` the gauge was anchored to.\n   */\n  event GaugeActivated(address indexed gauge, uint48 activationCursor);\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when a gas limit setter receives zero.\n  error ZeroGasLimit();\n\n  /// @notice Thrown when the caller is neither the veNFT's registered operator nor the Leaf MessageOrchestrator.\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a cross-chain entrypoint is called by anything but the Leaf MessageOrchestrator.\n   */\n  error NotMessageOrchestrator();\n\n  /**\n   * @notice Thrown when the local `allocateGauges` is called by anything but the tokenId's operator.\n   */\n  error NotOperator();\n\n  /**\n   * @notice Thrown when a gauge allocation runs before the per-chain cooldown has elapsed.\n   * @dev Gates on `allocationCooldown` minus the token's accumulated reduction, consumed on a passing call.\n   */\n  error CooldownActive();\n\n  /**\n   * @notice Thrown when the minimum incentive duration is set to zero.\n   */\n  error ZeroDuration();\n\n  /**\n   * @notice Thrown by `applyGaugeAllocations` past the root-stamped `expiry`; root must re-dispatch.\n   */\n  error AllocationExpired();\n\n  /**\n   * @notice Thrown when a gauge-lifecycle entrypoint is called by an address other than the GaugeManager.\n   */\n  error NotGaugeManager();\n\n  /**\n   * @notice Thrown by `registerGauge` when the gauge is already registered.\n   */\n  error GaugeAlreadyRegistered();\n\n  /**\n   * @notice Thrown by `activateGauge` when the gauge is already activated.\n   */\n  error GaugeAlreadyActivated();\n\n  /**\n   * @notice Thrown by `allocateGauges` while local voting is disabled, which is the default.\n   */\n  error LocalVotingDisabled();\n\n  /**\n   * @notice Thrown when a local `allocateGauges` runs before any chain allocation seeded the stake shape.\n   * @dev Defense in depth: `applyChainAllocation` seeds the shape first, so this should be unreachable. It\n   *      stops a distribution against the default permanent shape if that ordering ever breaks.\n   */\n  error StakeSnapshotMissing();\n\n  /**\n   * @notice Thrown when the allocated amounts do not exactly equal the tokenId's `chainAllocation`.\n   * @dev Counts the `DEALLOC_GAUGE` sentinel and the explicit `ZERO_GAUGE` idle entry; there is no backfill.\n   */\n  error ChainAllocationMismatch();\n\n  /**\n   * @notice Thrown when a local allocation targets more gauges than `maxGauges`.\n   * @dev The cap keeps a tokenId's gauge set within the bound root's reduction-message gas budgeting assumes.\n   */\n  error ExceedsMaxGauges();\n\n  /**\n   * @notice Thrown by `activateGauge` for an unregistered gauge, and by `forfeitEmissions` for a non-gauge caller.\n   */\n  error GaugeNotRegistered();\n\n  /**\n   * @notice Thrown when `mintEmissions` is invoked with `_recipients.length != _amounts.length`.\n   */\n  error ArrayLengthMismatch();\n\n  /**\n   * @notice Thrown when the redeem amount is smaller than `MIN_REDEEM_AMOUNT`.\n   */\n  error AmountTooLow();\n\n  /**\n   * @notice Thrown when `mintEmissions` claims more than `ceiling - claimed - surplus`.\n   */\n  error CeilingExceeded();\n\n  /**\n   * @notice Thrown when `mintEmissions`, `redeem` or `allocateGauges` is called while the chain status is\n   *         neither `Active` nor `Sunset`.\n   */\n  error ChainNotActiveOrSunset();\n\n  /*//////////////////////////////////////////////////////////////\n                                EXTERNAL\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Sets gas forwarded by reward managers when flushing gauge fees.\n   * @dev Requires GAS_CONFIGURER_ROLE. Must be nonzero; applies to every subsequent flush.\n   * @param _gasLimit New gas limit shared by this chain's reward managers.\n   */\n  function setCollectFeesGasLimit(uint256 _gasLimit) external;\n\n  /**\n   * @notice Mints `ReceiptToken` to the `EmissionsHandler` and calls it back per recipient. Gauge only.\n   * @dev Reverts `ChainNotActiveOrSunset` unless the chain is `Active` or `Sunset`, though the settled entitlement\n   *      survives the pause. Reverts `GaugeNotRegistered` for other callers and `CeilingExceeded` above the\n   *      gauge's headroom `ceiling - claimed - surplus`.\n   * @dev `claimed` is raised before the mint; the callback MUST NOT rely on further `LeafVoter` writes.\n   * @param _recipients Recipients for the per-leg delivery (LP, referral).\n   * @param _amounts Per-leg amounts of `ReceiptToken`.\n   */\n  function mintEmissions(address[] calldata _recipients, uint128[] calldata _amounts) external;\n\n  /**\n   * @notice Burns the caller's `ReceiptToken` and dispatches a `Redeem` message to root to mint `TOKEN`.\n   * @dev Reverts `ChainNotActiveOrSunset` unless the chain is `Active` or `Sunset`, and `AmountTooLow` below\n   *      `MIN_REDEEM_AMOUNT`.\n   * @dev `surplusAccrued` rides in the payload so root books it into `reportedSurplus`.\n   * @param _amount Amount of `ReceiptToken` to burn and `TOKEN` to mint on root.\n   * @param _recipient Address that receives the minted `TOKEN` on root.\n   * @param _gasLimit Execution gas reserved for the destination handler.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function redeem(uint256 _amount, address _recipient, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /**\n   * @notice Claims fee and incentive rewards through the LeafVoter in one transaction.\n   * @dev Callable by the veNFT's registered operator or the Leaf MessageOrchestrator. Fee claims are processed\n   *      before incentive claims. Unregistered managers are skipped; registered-manager reverts bubble to make an\n   *      inbound claim message retryable.\n   * @param _tokenId The veNFT token ID to claim for.\n   * @param _recipient Address to receive the claimed rewards.\n   * @param _feeClaims Fee claim requests to forward.\n   * @param _incentiveClaims Incentive claim requests to forward.\n   */\n  function claimRewards(\n    uint256 _tokenId,\n    address _recipient,\n    FeeClaim[] calldata _feeClaims,\n    IncentiveClaim[] calldata _incentiveClaims\n  ) external;\n\n  /**\n   * @notice Applies a chain-level allocation from root. Leaf MessageOrchestrator only.\n   * @dev Additive, never an overwrite, so it cannot resurrect a budget `deallocate` already removed. Carries no\n   *      gauges, is never cooldown-gated, and never reverts on a well-formed call. Runs while `Suspended` with\n   *      the scalar forced to zero (root diverts that period to surplus); delta and snapshot still apply.\n   * @dev While the token holds no gauge weight, the whole chain budget re-parks on `ZERO_GAUGE` anchored at the\n   *      latest shape, so a park whose stored shape expired revives on the next message, poke included.\n   * @param _tokenId Originating tokenId.\n   * @param _allocationDelta Voting power added to the tokenId's chain budget (always an increase).\n   * @param _emissionsPerVP New global emissions per voting power, `PRECISION`-scaled; zero while `Suspended`.\n   * @param _refreshEmissionsPerVP Newest chain allocation seen; only then is `_emissionsPerVP` written.\n   * @param _refreshShape Newest shape the token has seen; only then is `latestTokenSnapshot` updated.\n   * @param _snapshot Live VE shape; stored as `latestTokenSnapshot` when newest.\n   */\n  function applyChainAllocation(\n    uint256 _tokenId,\n    uint128 _allocationDelta,\n    uint256 _emissionsPerVP,\n    bool _refreshEmissionsPerVP,\n    bool _refreshShape,\n    TokenSnapshot calldata _snapshot\n  ) external;\n\n  /**\n   * @notice Applies a gauge distribution from root. Leaf MessageOrchestrator only.\n   * @dev Full overwrite: omitted gauges are cleared and budget above `Σ _gauges` parks on `ZERO_GAUGE`.\n   * @dev Reverts `CooldownActive` while the cooldown runs, so the transport redelivers later without spending\n   *      the token's reduction, and `AllocationExpired` past `_expiry`.\n   * @param _tokenId Originating tokenId.\n   * @param _expiry Root-stamped deadline; the message expires once `block.timestamp` passes it.\n   * @param _emissionsPerVP Global emissions-per-VP scalar at dispatch, `PRECISION`-scaled.\n   * @param _refreshEmissionsPerVP Newest message the leaf has seen; only then is `_emissionsPerVP` written.\n   * @param _refreshShape Newest shape the token has seen. If false, the vote books at the stored shape instead.\n   * @param _newSnapshot Live sAERO position state at dispatch time.\n   * @param _gauges Per-gauge allocations on this chain.\n   * @return _callParamsList One entry per touched gauge whose reward checkpoint this call already drove.\n   */\n  function applyGaugeAllocations(\n    uint256 _tokenId,\n    uint48 _expiry,\n    uint256 _emissionsPerVP,\n    bool _refreshEmissionsPerVP,\n    bool _refreshShape,\n    TokenSnapshot calldata _newSnapshot,\n    GaugeAllocation[] calldata _gauges\n  ) external returns (CheckpointData[] memory _callParamsList);\n\n  /**\n   * @notice Adds `_reduction` to a tokenId's accumulated cooldown reduction. Leaf MessageOrchestrator only.\n   * @dev Additive, so grants stack and order does not matter; the `uint48` add reverts on overflow.\n   * @param _tokenId veNFT id whose accumulated cooldown reduction increases.\n   * @param _reduction Seconds added.\n   */\n  function applyCooldownReduction(uint256 _tokenId, uint48 _reduction) external;\n\n  /**\n   * @notice Clears a token's gauge distribution here and cuts its chain budget. Leaf MessageOrchestrator only.\n   * @dev Subtracts rather than zeroes, so order against `AllocateChain` deltas booked before the drain does not\n   *      matter; the remaining budget parks on `ZERO_GAUGE`. Clamped at zero, so `_amount >= chainAllocation`\n   *      is the full unwind. Runs whatever the chain status is.\n   * @dev Clamping under-corrects a post-resume delta, so governance must not resume the chain until\n   *      `EmergencyDeallocationApplied` signals delivery (see `IVoter.setChainStatus`).\n   * @param _tokenId veNFT id whose position on the chain is reduced.\n   * @param _amount Chain budget root drained; subtracted from `chainAllocation` (clamped at zero).\n   */\n  function applyEmergencyDeallocation(uint256 _tokenId, uint128 _amount) external;\n\n  /**\n   * @notice Sets a tokenId's operator. Leaf MessageOrchestrator only.\n   * @dev Unconditional overwrite that never reverts on a well-formed call; `address(0)` clears it.\n   * @param _tokenId The tokenId whose operator is being assigned.\n   * @param _operator The new operator address, or `address(0)` to clear.\n   */\n  function setOperator(uint256 _tokenId, address _operator) external;\n\n  /**\n   * @notice Spreads the tokenId's `chainAllocation` budget across gauges. Operator only.\n   * @dev Reverts `ChainNotActiveOrSunset`, `LocalVotingDisabled`, `NotOperator`, `CooldownActive`,\n   *      `StakeSnapshotMissing`, `ExceedsMaxGauges`, and `ChainAllocationMismatch`. Entries must be strictly\n   *      ascending with non-zero amounts. An expired stake may only submit the lone `DEALLOC_GAUGE` sentinel\n   *      returning its whole budget; any other list reverts `StakeExpired`. A sunset chain accepts only that\n   *      same lone sentinel; any other list, empty included, reverts `SunsetDeallocOnly`.\n   * @dev `payable` because a `DEALLOC_GAUGE` entry returns that amount to root in the same call, so `msg.value`\n   *      must cover the quoted transport fee (excess refunded). No sentinel, no value needed.\n   * @param _tokenId The tokenId to allocate with.\n   * @param _gauges Full overwrite: omitted gauges are cleared, budget above `Σ _gauges` parks on `ZERO_GAUGE`.\n   */\n  function allocateGauges(uint256 _tokenId, GaugeAllocation[] calldata _gauges) external payable;\n\n  /**\n   * @notice Register a gauge on the voter, initializing the gauge state that\n   *         settlement and allocation read.\n   * @dev GaugeManager only. Settles the chain index to `block.timestamp`, then\n   *      seeds the gauge's settlement cursor from the chain cursor. Reverts on\n   *      the zero address and an already-registered gauge. Relationship\n   *      validation is owned by `FactoryRegistry.registerGauge` in the same\n   *      transaction. Emits `GaugeRegistered`, plus `GaugeActivated` when the\n   *      module activates at registration.\n   * @param _gauge The gauge address to register.\n   * @param _activate Whether the gauge activates at registration, from the\n   *                  creating module's activation policy.\n   */\n  function registerGauge(address _gauge, bool _activate) external;\n\n  /**\n   * @notice Activate a registered gauge so later allocations reach it instead of `ZERO_GAUGE`. Activation is\n   *         one-way.\n   * @dev GaugeManager only. Settles the chain index to `block.timestamp`, then settles the gauge so its cursor\n   *      advances from registration to activation. Inactive gauges are never routable, so the settled window is\n   *      weightless. Reverts `GaugeNotRegistered` for an unregistered gauge and `ZERO_GAUGE`, and\n   *      `GaugeAlreadyActivated` for an activated gauge. Emits `GaugeActivated` with the effective activation\n   *      cursor.\n   * @param _gauge The registered gauge address to activate.\n   */\n  function activateGauge(address _gauge) external;\n\n  /**\n   * @notice Settles the chain index and then `_gauge`, returning its cumulative reward share. Permissionless.\n   * @dev Returns `0` without settling for an unregistered gauge, so it never reverts. Never calls the gauge.\n   * @param _gauge The gauge to settle.\n   * @return _cumulativeRewardShare Cumulative capped effective-share (TOKEN units) after settling.\n   */\n  function settleGauge(address _gauge) external returns (uint256 _cumulativeRewardShare);\n\n  /**\n   * @notice Forfeits surplus the caller cannot distribute (Idle Gauge, Early Exit). Registered gauge only.\n   * @dev Reverts `GaugeNotRegistered`. `_amount` is clamped to the headroom `ceiling - claimed - surplus`, then\n   *      added to the gauge's `surplus` and to the chain-level `surplusAccrued`.\n   * @param _amount The surplus the calling gauge is forfeiting.\n   */\n  function forfeitEmissions(uint128 _amount) external;\n\n  /**\n   * @notice Sets whether a tokenId may route weight onto activated gauges whose emission cap is zero,\n   *         positioning for fee recovery while the zero cap keeps the gauge's emissions in surplus. When unset,\n   *         such allocations redirect to `ZERO_GAUGE`. Inactive gauges are never routable regardless of this\n   *         flag.\n   * @dev `TOKEN_WHITELIST_ROLE` only.\n   * @param _tokenId The tokenId whose flag is being set.\n   * @param _allowed The new flag value.\n   */\n  function setCanVoteForZeroCapGauges(uint256 _tokenId, bool _allowed) external;\n\n  /**\n   * @notice Opens or closes the local `allocateGauges` path. `VOTER_CONFIG_ROLE` only.\n   * @dev Defaults to false; while closed `allocateGauges` reverts `LocalVotingDisabled`, bridged path unchanged.\n   * @param _enabled New switch value.\n   */\n  function setLocalVotingEnabled(bool _enabled) external;\n\n  /**\n   * @notice Sets the minimum seconds between local allocations for a tokenId. `VOTER_CONFIG_ROLE` only.\n   * @param _allocationCooldown The new cooldown duration in seconds.\n   */\n  function setAllocationCooldown(uint48 _allocationCooldown) external;\n\n  /**\n   * @notice Sets the cap on a tokenId's accumulated cooldown reduction. `VOTER_CONFIG_ROLE` only.\n   * @dev `applyCooldownReduction` clamps here instead of reverting, so a redelivery never reverts forever.\n   * @dev Zero is the default and disables reductions. Any cap at or above `allocationCooldown` is unbounded.\n   * @param _maxAccumulatedCooldownReduction The new accumulation cap, in seconds.\n   */\n  function setMaxAccumulatedCooldownReduction(uint48 _maxAccumulatedCooldownReduction) external;\n\n  /**\n   * @notice Sets the minimum duration for new incentive programs. `VOTER_CONFIG_ROLE` only.\n   * @param _minIncentiveDuration The new minimum duration in seconds.\n   */\n  function setMinIncentiveDuration(uint48 _minIncentiveDuration) external;\n\n  /**\n   * @notice Sets the per-chain cap on gauges a tokenId may allocate to locally. `VOTER_CONFIG_ROLE` only.\n   * @dev Leaf-owned; root enforces nothing here. Zero is the default and bricks `allocateGauges`.\n   * @param _maxGauges The new gauge-count cap.\n   */\n  function setMaxGauges(uint256 _maxGauges) external;\n\n  /**\n   * @notice Sets the chain's operational status. `CHAIN_STATUS_ROLE` only.\n   * @dev Rejects a `None` target (`InvalidStatus`) and same-value writes; `Suspended` only exits to `Active`\n   *      or `Sunset` and `Sunset` only exits to `Suspended` (`InvalidChainStatusTransition`). Settles the\n   *      index at the old rate up to the flip; a pre-settling message can bank accrual past it, so the\n   *      boundary is `max(flip, lastSettlement)`.\n   * @dev Reactivating a sunset leaf routes through `Suspended` first, so the in-flight deallocation set can\n   *      drain before the resume — see the procedure on `IVoter.setChainStatus`.\n   * @dev Entering `Suspended` or `Sunset` forces `emissionsPerVP` to zero until the first root dispatch after\n   *      a resume to `Active`. `allocateGauges`, `redeem` and `mintEmissions` stay open\n   *      under `Active` and `Sunset` and close under everything else; `Deallocate` still dispatches. Flip leaf\n   *      before root when suspending or sunsetting and resume root before leaf, so the gap under-emits.\n   * @param _status The new chain status.\n   */\n  function setChainStatus(ChainStatus _status) external;\n\n  /**\n   * @notice Projects a gauge's cumulative reward share to `block.timestamp` without writing.\n   * @dev Equals what `settleGauge(_gauge)` would return in this block. Returns `0` for an unregistered gauge.\n   * @param _gauge The gauge to project.\n   * @return _cumulativeRewardShare Projected cumulative capped effective-share (TOKEN units).\n   */\n  function projectedCumulativeRewardShare(address _gauge) external view returns (uint256 _cumulativeRewardShare);\n\n  /*//////////////////////////////////////////////////////////////\n                                VARIABLES\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Sink for weight aimed at gauges that cannot receive emissions; it accrues there as surplus.\n   *         Allocations to unregistered or unactivated gauges, and to zero-cap gauges the tokenId is not\n   *         whitelisted for, are redirected here.\n   * @return _zeroGauge The sink address (`address(0)`).\n   */\n  function ZERO_GAUGE() external view returns (address _zeroGauge);\n\n  /**\n   * @notice Minimum redeem amount, `1_000_000` (one unit in pips), so the Splitter share cannot round to zero.\n   * @return _minRedeemAmount The minimum redeem amount.\n   */\n  function MIN_REDEEM_AMOUNT() external view returns (uint256 _minRedeemAmount);\n\n  /**\n   * @notice Leaf-side messaging orchestrator this voter dispatches through. Set at deployment, immutable.\n   * @return _orchestrator The bound leaf messaging orchestrator.\n   */\n  function ORCHESTRATOR() external view returns (ILeafMessageOrchestrator _orchestrator);\n\n  /**\n   * @notice `ReceiptToken` burned on redeem. Set at deployment, immutable.\n   * @return _receiptToken The bound `ReceiptToken`.\n   */\n  function RECEIPT_TOKEN() external view returns (IReceiptToken _receiptToken);\n\n  /**\n   * @notice `EmissionsHandler` that receives `ReceiptToken` from `mintEmissions` and the callback.\n   * @return _emissionsHandler Configured handler.\n   */\n  function EMISSIONS_HANDLER() external view returns (address _emissionsHandler);\n\n  /**\n   * @notice FactoryRegistry queried for per-gauge emission caps and reward\n   *         contracts during settlement. Set at deployment, immutable.\n   * @return _factoryRegistry The configured FactoryRegistry.\n   */\n  function FACTORY_REGISTRY() external view returns (IFactoryRegistry _factoryRegistry);\n\n  /**\n   * @notice GaugeManager authorized for the gauge-lifecycle writes,\n   *         `registerGauge` and `activateGauge`. Set at deployment, immutable.\n   * @return _gaugeManager The configured GaugeManager.\n   */\n  function GAUGE_MANAGER() external view returns (address _gaugeManager);\n\n  /**\n   * @notice Operational status, `Active` by default. `allocateGauges`, `redeem` and `mintEmissions` stay open\n   *         under `Active` and `Sunset` and are blocked under every other value.\n   * @return _status Current chain status.\n   */\n  function chainStatus() external view returns (ChainStatus _status);\n\n  /**\n   * @notice Latest emissions-per-VP scalar from root; written only on a fresh message, zero while `Suspended`\n   *         or `Sunset`.\n   * @return _emissionsPerVP Global emissions per unit voting power, `PRECISION`-scaled.\n   */\n  function emissionsPerVP() external view returns (uint256 _emissionsPerVP);\n\n  /**\n   * @notice Cumulative AERO rewards per unit of chain weight; only ever increases.\n   * @return _index Current accumulator index.\n   */\n  function index() external view returns (uint256 _index);\n\n  /**\n   * @notice Time-weighted chain accumulator: `emissionsPerVP` integrated against absolute (unix-epoch) time,\n   *         stored doubled. Paired with `index` it prices a decaying gauge's share exactly across a scalar\n   *         change, matching root.\n   * @return _timeIndex Current time-weighted accumulator value, doubled.\n   */\n  function timeIndex() external view returns (uint256 _timeIndex);\n\n  /**\n   * @notice Timestamp `index` is settled to. May be ahead of `block.timestamp` after a pre-settling message.\n   * @return _ts Last chain settlement timestamp.\n   */\n  function lastSettlement() external view returns (uint48 _ts);\n\n  /**\n   * @notice Snapshot of `index` at each weekly boundary; per-gauge settlement reads it for per-segment shares.\n   * @param _boundary Weekly-aligned timestamp.\n   * @return _indexSnapshot Value of `index` snapshotted at `_boundary`.\n   */\n  function indexAtBoundary(uint48 _boundary) external view returns (uint256 _indexSnapshot);\n\n  /**\n   * @notice Snapshot of `timeIndex` at each weekly boundary; per-gauge settlement reads it for the slope correction.\n   * @param _boundary Weekly-aligned timestamp.\n   * @return _timeIndexSnapshot Value of `timeIndex` snapshotted at `_boundary`.\n   */\n  function timeIndexAtBoundary(uint48 _boundary) external view returns (uint256 _timeIndexSnapshot);\n\n  /**\n   * @notice Whether a gauge is activated for direct allocation routing. Cheaper than reading `gaugeStates`.\n   * @param _gauge Gauge address to query.\n   * @return _isActivated Whether the gauge is activated.\n   */\n  function isActivated(address _gauge) external view returns (bool _isActivated);\n\n  /**\n   * @notice Per-gauge settlement state.\n   * @param _gauge Gauge address to query.\n   * @return _ceiling Cumulative effective share credited to the gauge.\n   * @return _claimed Cumulative emissions minted by the claim flow.\n   * @return _lastSettlement Timestamp of the gauge's last settlement.\n   * @return _isRegistered Whether the gauge was produced by an approved factory.\n   * @return _isActivated Whether the gauge is activated for direct allocation routing.\n   * @return _surplus Cumulative surplus attributed to the gauge.\n   * @return _lastIndex Snapshot of `index` at the gauge's last settlement.\n   * @return _lastTimeIndex Snapshot of `timeIndex` at the gauge's last settlement.\n   * @return _point Decaying weight of the gauge.\n   */\n  function gaugeStates(address _gauge)\n    external\n    view\n    returns (\n      uint128 _ceiling,\n      uint128 _claimed,\n      uint48 _lastSettlement,\n      bool _isRegistered,\n      bool _isActivated,\n      uint128 _surplus,\n      uint256 _lastIndex,\n      uint256 _lastTimeIndex,\n      Point memory _point\n    );\n\n  /**\n   * @notice Scheduled slope reduction for a gauge at a weekly expiry boundary.\n   * @param _gauge Gauge address to query.\n   * @param _expiry Expiry timestamp.\n   * @return _slopeDelta Slope reduction scheduled at `_expiry`.\n   */\n  function gaugeSlopeChanges(address _gauge, uint48 _expiry) external view returns (int128 _slopeDelta);\n\n  /**\n   * @notice Packed per-tokenId allocation state.\n   * @dev `chainAllocation` is raised by `applyChainAllocation`, cut by `applyEmergencyDeallocation` (clamped at\n   *      zero), and bounds the incoming gauge sum.\n   * @param _tokenId veNFT id to query.\n   * @return _operator The tokenId's operator, or `address(0)` if unset.\n   * @return _lastAllocated Last-allocated timestamp.\n   * @return _canVoteForZeroCapGauges True when the token may route weight onto activated zero-cap gauges.\n   * @return _chainAllocation Chain allocation budget for the tokenId.\n   */\n  function tokenStates(uint256 _tokenId)\n    external\n    view\n    returns (address _operator, uint48 _lastAllocated, bool _canVoteForZeroCapGauges, uint128 _chainAllocation);\n\n  /**\n   * @notice Shape the token's booked gauge weight is measured with. Read by reward contracts at checkpoint.\n   * @param _tokenId veNFT id to query.\n   * @return _staked AERO staked in the position at dispatch time.\n   * @return _stakeEnd Stake expiry; `0` for a permanent stake.\n   * @return _isPermanent True for a permanent stake.\n   */\n  function tokenSnapshot(uint256 _tokenId) external view returns (uint128 _staked, uint48 _stakeEnd, bool _isPermanent);\n\n  /**\n   * @notice Newest root-dispatched `TokenSnapshot` for a tokenId, applied or not.\n   * @dev Never behind `tokenSnapshot`; the next gauge-iterating operation consumes it and the two match again.\n   * @param _tokenId veNFT id to query.\n   * @return _staked AERO staked in the position at dispatch time.\n   * @return _stakeEnd Stake expiry; `0` for a permanent stake.\n   * @return _isPermanent True for a permanent stake.\n   */\n  function latestTokenSnapshot(uint256 _tokenId)\n    external\n    view\n    returns (uint128 _staked, uint48 _stakeEnd, bool _isPermanent);\n\n  /**\n   * @notice Per-`(tokenId, effective gauge)` allocated weight; redirected weight aggregates on `ZERO_GAUGE`.\n   * @param _tokenId veNFT id to query.\n   * @param _gauge Effective gauge address to query.\n   * @return _allocated Weight the tokenId currently has on the gauge.\n   */\n  function allocations(uint256 _tokenId, address _gauge) external view returns (uint128 _allocated);\n\n  /**\n   * @notice Cumulative AERO on this chain that will not be redeemed; only ever increases, sent in every REDEEM.\n   * @return _surplus Cumulative surplus.\n   */\n  function surplusAccrued() external view returns (uint256 _surplus);\n\n  /**\n   * @notice Whether the local `allocateGauges` path is open. False until governance opens it.\n   * @return _enabled Current switch value.\n   */\n  function localVotingEnabled() external view returns (bool _enabled);\n\n  /**\n   * @notice Minimum seconds between local allocations for a tokenId.\n   * @return _cooldown Cooldown duration.\n   */\n  function allocationCooldown() external view returns (uint48 _cooldown);\n\n  /**\n   * @notice Cap on a tokenId's accumulated cooldown reduction. Zero, the default, disables reductions.\n   * @return _maxAccumulatedCooldownReduction The accumulation cap, in seconds.\n   */\n  function maxAccumulatedCooldownReduction() external view returns (uint48 _maxAccumulatedCooldownReduction);\n\n  /**\n   * @notice Minimum duration for new incentive programs.\n   * @return _minIncentiveDuration The minimum duration in seconds.\n   */\n  function minIncentiveDuration() external view returns (uint48 _minIncentiveDuration);\n\n  /**\n   * @notice Per-chain cap on gauges a tokenId may allocate to locally. Leaf-owned; root holds no equivalent.\n   * @return _maxGauges The gauge-count cap.\n   */\n  function maxGauges() external view returns (uint256 _maxGauges);\n\n  /**\n   * @notice Reduction accrued for a tokenId, in seconds; the next allocation consumes it, clamped to the cooldown.\n   * @param _tokenId veNFT id.\n   * @return _reduction Accumulated reduction in seconds, or zero if none.\n   */\n  function accumulatedCooldownReduction(uint256 _tokenId) external view returns (uint48 _reduction);\n\n  /*//////////////////////////////////////////////////////////////\n                                  VIEWS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Operator authorized to run the local `allocateGauges` for a tokenId.\n   * @param _tokenId veNFT id to query.\n   * @return _operator The tokenId's operator, or `address(0)` if unset.\n   */\n  function operator(uint256 _tokenId) external view returns (address _operator);\n\n  /**\n   * @notice Effective gauges the tokenId has weight on. Excludes `ZERO_GAUGE`: read parked weight with\n   *         `allocations(_tokenId, ZERO_GAUGE)`.\n   * @param _tokenId veNFT id to query.\n   * @return _gauges The set's values as a memory array.\n   */\n  function allocatedGauges(uint256 _tokenId) external view returns (address[] memory _gauges);\n\n  /**\n   * @notice Returns the gas limit used by reward managers when flushing gauge fees.\n   * @return _gasLimit The gauge fee collection gas limit.\n   */\n  function collectFeesGasLimit() external view returns (uint256 _gasLimit);\n}\n"},"V3/src/libraries/ProtocolConstants.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\n/// @dev Pips denominator where `1_000_000` is 100%.\nuint256 constant MAX_PIPS = 1_000_000;\n\n/// @dev Minimum receipt amount redeemable, one unit in pips, so the Splitter share cannot round to zero.\nuint256 constant MIN_REDEEM_AMOUNT = MAX_PIPS;\n\n/// @dev Sink gauge for idle voting power. Allocations to gauges that cannot receive emissions redirect\n///      here and accrue as surplus.\naddress constant ZERO_GAUGE = address(0);\n\n/// @dev Seconds in one weekly epoch.\nuint48 constant WEEK = 1 weeks;\n\n/// @dev Maximum staking period in seconds (4 years).\nuint48 constant MAXTIME = 4 * 365 days;\n\n/// @dev Lower bound for configured message lifetimes, rejects values that would expire every dispatch in transit.\nuint48 constant MIN_MESSAGE_LIFETIME = 2 minutes;\n\n/// @dev Upper bound for configured message lifetimes, keeps every stamped expiry far from uint48 overflow.\nuint48 constant MAX_MESSAGE_LIFETIME = 365 days;\n\n/// @dev Fixed point scale of 1e18.\nuint256 constant PRECISION = 1e18;\n\n/// @dev Smallest stake the protocol accepts, one whole TOKEN. A dust stake costs more to carry than it\n///      is worth, and a Relay seeded with one leaves a share supply small enough that the price per\n///      share can be lifted until a later deposit rounds down to a fraction of what it paid.\nuint256 constant MIN_STAKE_AMOUNT = 1e18;\n\n/// @dev Fixed-point scale used by the fee accumulators.\nuint256 constant FEE_ACCUMULATOR_PRECISION = 1e24;\n\n/// @dev Sentinel gauge address expressing deallocation intent in a gauge list. Shared so the root\n///      `Voter` and every `LeafVoter` agree on the value: root detects it in a bridged gauge list and\n///      the leaf turns it into a return-to-root deallocation. Derived from a fixed string so it can\n///      never collide with a real gauge.\naddress constant DEALLOC_GAUGE = address(uint160(uint256(keccak256('DROMOS_DEALLOC_GAUGE'))));\n"},"V3/src/interfaces/relay/IRelayState.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IRelay} from 'V3/interfaces/relay/IRelay.sol';\nimport {IRelayToken} from 'V3/interfaces/relay/IRelayToken.sol';\n\n/**\n * @title  IRelayState\n * @notice The part of the Relay's own external interface that its libraries read back through\n *         self-calls.\n */\ninterface IRelayState {\n  /// @notice The VotingEscrow holding the Relay's stake, whose staked amount is the upper bound of\n  ///         what the queue can be owed.\n  /// @return The escrow.\n  function VOTING_ESCROW() external view returns (IVotingEscrow);\n\n  /// @notice The protocol TOKEN staked behind the Relay's sAERO.\n  /// @return The protocol TOKEN address.\n  function TOKEN() external view returns (address);\n\n  /// @notice Checkpointed RelayToken implementation cloned as the principal token.\n  /// @return The principal-token implementation address.\n  function PRINCIPAL_TOKEN_IMPLEMENTATION() external view returns (address);\n\n  /// @notice Plain RelayToken implementation cloned as the yield token.\n  /// @return The yield-token implementation address.\n  function YIELD_TOKEN_IMPLEMENTATION() external view returns (address);\n\n  /// @notice The Relay's configuration block.\n  /// @return _config The full configuration struct.\n  function relayConfig() external view returns (IRelay.RelayConfig memory _config);\n\n  /// @notice The Relay's backing counter.\n  /// @return The current backing.\n  function totalBacking() external view returns (uint256);\n\n  /// @notice Shares escrowed across the queued, undrained withdrawals.\n  /// @return The escrowed-share total.\n  function pendingWithdrawalShares() external view returns (uint256);\n\n  /// @notice The Relay's principal token, whose supply prices the escrowed shares.\n  /// @return The principal token.\n  function principalToken() external view returns (IRelayToken);\n\n  /// @notice The Relay's yield token, banned from the reward registry along with the principal.\n  /// @return The yield token.\n  function yieldToken() external view returns (IRelayToken);\n\n  /// @notice Ceiling of each rake rate, in pips.\n  /// @return The rake ceiling.\n  function MAX_RAKE_PIPS() external view returns (uint256);\n\n  /// @notice Factory that initialized the Relay; it names the rake treasury.\n  /// @return The factory address.\n  function factory() external view returns (address);\n}\n"},"V3/src/interfaces/relay/IRelayToken.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title  IRelayToken\n * @notice Satellite ERC-20 the Relay clones twice at initialization: once as the principal token\n *         (PT, the priced position carrying the withdraw right) and once as the yield token (YT,\n *         the balance the reward accumulator reads). Mint and burn are Relay-only; holder transfers\n *         are gated by the per-clone `transferable` switch.\n * @dev    Includes the duplicated ERC-20 slice the Relay consumes (`balanceOf`, `totalSupply`) —\n *         duplicated-slice interfaces are accepted repo precedent, see IRelayEntrypoint's dev note.\n */\ninterface IRelayToken {\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                  CUSTOM ERRORS                                     __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Thrown when `mint` or `burn` is called by anyone other than the bound Relay.\n  error NotRelay();\n\n  /// @notice Thrown on `transfer`/`transferFrom` when the clone was initialized as\n  ///         non-transferable (soulbound).\n  error TokenNotTransferable();\n\n  /// @notice Thrown when a transfer names the zero address, or a share mint names the Relay or a satellite.\n  error InvalidRecipient();\n\n  /// @notice Thrown when `initialize` runs a second time, or on the implementation itself.\n  error AlreadyInitialized();\n\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/\n  /*                                                    FUNCTIONS                                       __|__         */\n  /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  --@--@--(_)--@--@--  */\n\n  /// @notice Initialize a freshly cloned satellite: bind the calling Relay and store the metadata.\n  /// @param _name ERC-20 name, stored per clone; no setter.\n  /// @param _symbol ERC-20 symbol, stored per clone; no setter.\n  /// @param _transferable Whether holder-to-holder transfers are allowed. Immutable switch: set\n  ///        once here, no setter.\n  /// @dev The Relay clones the token inside its own `initialize`, so `msg.sender` is the Relay by\n  ///      construction. Callable once; the implementation's constructor marks itself initialized.\n  function initialize(string calldata _name, string calldata _symbol, bool _transferable) external;\n\n  /// @notice Mint `_amount` tokens to `_to`. Relay-only.\n  /// @param _to Recipient of the minted tokens.\n  /// @param _amount Token amount to mint.\n  function mint(address _to, uint256 _amount) external;\n\n  /// @notice Burn `_amount` tokens from `_from`. Relay-only.\n  /// @param _from Holder whose tokens burn.\n  /// @param _amount Token amount to burn.\n  function burn(address _from, uint256 _amount) external;\n\n  /// @notice The Relay this satellite is bound to: the only authorized mint/burn caller, the\n  ///         target of the balance-change hook and a banned transfer recipient.\n  /// @return _relay The Relay address.\n  function relay() external view returns (address _relay);\n\n  /// @notice Whether holder-to-holder transfers are allowed. Immutable switch: set once at\n  ///         initialization, no setter.\n  /// @return _transferable True when the token is transferable, false when soulbound.\n  function transferable() external view returns (bool _transferable);\n\n  /// @notice The token balance of `_owner`.\n  /// @param _owner Holder to read.\n  /// @return _balance The holder's current balance.\n  function balanceOf(address _owner) external view returns (uint256 _balance);\n\n  /// @notice The total token supply.\n  /// @return _totalSupply The current total supply.\n  function totalSupply() external view returns (uint256 _totalSupply);\n}\n\n/**\n * @title  IRelayTokenHook\n * @notice The Relay-side callback every RelayToken balance change reports to, fired BEFORE any\n *         balance mutates so the Relay's reward settle reads pre-change balances.\n * @dev    Declared alongside IRelayToken as the token's minimal expectation of its Relay; the\n *         Relay implements it and authenticates the caller against its own satellite addresses.\n */\ninterface IRelayTokenHook {\n  /// @notice Reacts to an imminent balance change on a satellite token: authorizes the move and\n  ///         settles reward accrual against the pre-change balances.\n  /// @dev The tier seam behind this hook can narrow the recipients further, as Protocol does.\n  /// @param _from Sender (zero on mint).\n  /// @param _to Recipient (zero on burn).\n  /// @param _amount Token amount about to move.\n  function onRelayTokenTransfer(address _from, address _to, uint256 _amount) external;\n}\n"},"V3/src/metarouter/TransientTracking.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\n/**\n * @title TransientTracking\n * @notice Transient scalar, array, and mapping-like storage used during execution.\n * @dev All functions are internal, so they inline into the caller and tload/tstore operate\n *      on the calling contract's transient storage. Mapping values use\n *      `keccak256(abi.encode(key, namespace))`; Solidity does not support transient mappings.\n */\nlibrary TransientTracking {\n  /**\n   * @notice Stores a value in a transient slot.\n   * @param _slot Transient slot to write.\n   * @param _value Value to store.\n   */\n  function store(bytes32 _slot, uint256 _value) internal {\n    assembly {\n      tstore(_slot, _value)\n    }\n  }\n\n  /**\n   * @notice Stores a mapping-like transient value for `_key` under `_namespace`.\n   * @param _namespace Namespace used to derive the transient mapping slot.\n   * @param _key Address key whose value is written.\n   * @param _value Value to store for the key.\n   */\n  function storeMapping(bytes32 _namespace, address _key, uint256 _value) internal {\n    assembly {\n      mstore(0x00, _key)\n      mstore(0x20, _namespace)\n      tstore(keccak256(0x00, 0x40), _value)\n    }\n  }\n\n  /**\n   * @notice Adds `_key` to a transient array once per batch.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _namespace Namespace holding the transient deduplication flags.\n   * @param _key Address to track.\n   */\n  function track(bytes32 _arraySlot, bytes32 _namespace, address _key) internal {\n    if (loadMapping(_namespace, _key) != 0) return;\n    storeMapping(_namespace, _key, 1);\n    push(_arraySlot, _key);\n  }\n\n  /**\n   * @notice Appends an address to a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _value Address to append.\n   */\n  function push(bytes32 _arraySlot, address _value) internal {\n    uint256 _length = length(_arraySlot);\n    bytes32 _slot = _elementSlot(_arraySlot, _length);\n    assembly {\n      tstore(_slot, _value)\n    }\n    store(_arraySlot, _length + 1);\n  }\n\n  /**\n   * @notice Appends a `uint256` to a transient array.\n   * @dev Companion to `push` for full-width values such as NFT token IDs, index-aligned with a paired address array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _value Value to append.\n   */\n  function pushUint(bytes32 _arraySlot, uint256 _value) internal {\n    uint256 _length = length(_arraySlot);\n    bytes32 _slot = _elementSlot(_arraySlot, _length);\n    assembly {\n      tstore(_slot, _value)\n    }\n    store(_arraySlot, _length + 1);\n  }\n\n  /**\n   * @notice Resets a transient array for reuse in the same transaction.\n   * @dev Element slots are overwritten when reused and need not be cleared individually.\n   * @param _arraySlot Slot storing the transient array length.\n   */\n  function clear(bytes32 _arraySlot) internal {\n    store(_arraySlot, 0);\n  }\n\n  /**\n   * @notice Clears a transient tracked-address flag.\n   * @dev Transient storage is transaction-scoped, so flags must be cleared between batches in one transaction.\n   * @param _namespace Namespace holding the transient deduplication flag.\n   * @param _key Address whose flag is cleared.\n   */\n  function untrack(bytes32 _namespace, address _key) internal {\n    storeMapping(_namespace, _key, 0);\n  }\n\n  /**\n   * @notice Returns the length of a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @return _length Number of elements in the array.\n   */\n  function length(bytes32 _arraySlot) internal view returns (uint256 _length) {\n    return load(_arraySlot);\n  }\n\n  /**\n   * @notice Returns an address from a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _index Element index to read.\n   * @return _value Address stored at the index.\n   */\n  function at(bytes32 _arraySlot, uint256 _index) internal view returns (address _value) {\n    bytes32 _slot = _elementSlot(_arraySlot, _index);\n    assembly {\n      _value := tload(_slot)\n    }\n  }\n\n  /**\n   * @notice Returns a `uint256` from a transient array.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _index Element index to read.\n   * @return _value Value stored at the index.\n   */\n  function atUint(bytes32 _arraySlot, uint256 _index) internal view returns (uint256 _value) {\n    bytes32 _slot = _elementSlot(_arraySlot, _index);\n    assembly {\n      _value := tload(_slot)\n    }\n  }\n\n  /**\n   * @notice Loads a value from a transient slot.\n   * @param _slot Transient slot to read.\n   * @return _value Value stored in the slot.\n   */\n  function load(bytes32 _slot) internal view returns (uint256 _value) {\n    assembly {\n      _value := tload(_slot)\n    }\n  }\n\n  /**\n   * @notice Loads the mapping-like transient value for `_key` under `_namespace`.\n   * @param _namespace Namespace used to derive the transient mapping slot.\n   * @param _key Address key whose value is read.\n   * @return _value Value stored for the key.\n   */\n  function loadMapping(bytes32 _namespace, address _key) internal view returns (uint256 _value) {\n    assembly {\n      mstore(0x00, _key)\n      mstore(0x20, _namespace)\n      _value := tload(keccak256(0x00, 0x40))\n    }\n  }\n\n  /**\n   * @notice Derives the slot of an element using Solidity's dynamic-array layout.\n   * @param _arraySlot Slot storing the transient array length.\n   * @param _index Element index whose slot is derived.\n   * @return _slot Transient slot holding the element.\n   */\n  function _elementSlot(bytes32 _arraySlot, uint256 _index) private pure returns (bytes32 _slot) {\n    return bytes32(uint256(keccak256(abi.encode(_arraySlot))) + _index);\n  }\n}\n"},"V3/src/interfaces/core/IVotingEscrow.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IERC165} from '@openzeppelin/contracts/interfaces/IERC165.sol';\nimport {IERC4906} from '@openzeppelin/contracts/interfaces/IERC4906.sol';\nimport {IERC6372} from '@openzeppelin/contracts/interfaces/IERC6372.sol';\nimport {IERC721Enumerable} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';\nimport {IERC721, IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';\n\nimport {IGuardedAccessControlEnumerable} from 'V3/interfaces/access/IGuardedAccessControlEnumerable.sol';\nimport {IVotes} from 'V3/interfaces/core/IVotes.sol';\nimport {IToken} from 'V3/interfaces/token/IToken.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\n\ninterface IVotingEscrow is\n  IVotes,\n  IERC4906,\n  IERC6372,\n  IERC721Metadata,\n  IERC721Enumerable,\n  IGuardedAccessControlEnumerable\n{\n  /// @notice Deposit operation kind, used in the Deposit event.\n  /// @param CREATE_STAKE_TYPE Initial deposit creating a new stake.\n  /// @param INCREASE_STAKE_AMOUNT Adding tokens to an existing stake.\n  /// @param INCREASE_STAKING_PERIOD Extending the staking period of an existing stake.\n  /// @param REVIVE_STAKE_TYPE Deposit rebuilding an empty shell's stake on an existing tokenId.\n  enum DepositType {\n    CREATE_STAKE_TYPE,\n    INCREASE_STAKE_AMOUNT,\n    INCREASE_STAKING_PERIOD,\n    REVIVE_STAKE_TYPE\n  }\n\n  /// @notice Staked balance held by a sAERO. Packed into a single storage slot.\n  /// @param amount Underlying token amount staked.\n  /// @param end Unstake timestamp. Zero when the stake is permanent.\n  /// @param isPermanent Whether the stake is in permanent mode (no decay).\n  struct StakedBalance {\n    uint128 amount;\n    uint48 end;\n    bool isPermanent;\n  }\n\n  /// @notice Per-tokenId checkpoint of the staking curve. Packs into two storage slots.\n  /// @param bias Voting power at `ts` for the decay curve.\n  /// @param slope Per-second decay (-dweight / dt).\n  /// @param ts Timestamp at which the checkpoint was recorded.\n  /// @param permanent Amount counted as permanent at this checkpoint.\n  struct UserPoint {\n    int128 bias;\n    int128 slope;\n    uint48 ts;\n    uint128 permanent;\n  }\n\n  /// @notice Global checkpoint of the staking curve. Packs into two storage slots.\n  /// @param bias Total voting power at `ts` for the decay curves.\n  /// @param slope Aggregate per-second decay (-dweight / dt).\n  /// @param ts Timestamp at which the checkpoint was recorded.\n  /// @param permanentStakeBalance Total amount counted as permanent at this checkpoint.\n  struct GlobalPoint {\n    int128 bias;\n    int128 slope;\n    uint48 ts;\n    uint128 permanentStakeBalance;\n  }\n\n  /// @notice A checkpoint for recorded delegated voting weights at a certain timestamp.\n  /// @param fromTimestamp Timestamp at which the checkpoint took effect.\n  /// @param owner Owner of the tokenId at the checkpoint timestamp.\n  /// @param delegatedBalance Balance delegated to the owner at the checkpoint timestamp.\n  /// @param delegatee tokenId the owner is delegating to.\n  struct Checkpoint {\n    uint256 fromTimestamp;\n    address owner;\n    uint256 delegatedBalance;\n    uint256 delegatee;\n  }\n\n  /// @notice Source movement of a VPM-initiated rebalance: staking weight drained from an existing tokenId.\n  /// @dev A source is always a real, existing tokenId. The accumulator (tokenId 0) is rejected as a source and the\n  ///      mint sentinel (type(uint256).max) is meaningless as one, so no sentinel handling applies. Carries no\n  ///      recipient: sources only drain, they never mint.\n  /// @param tokenId Existing tokenId the staking weight is drained from.\n  /// @param amount Underlying amount drained from tokenId.\n  struct SourceDelta {\n    uint256 tokenId;\n    uint128 amount;\n  }\n\n  /// @notice Destination movement of a VPM-initiated rebalance: staking weight routed to a tokenId, mint, or accumulator.\n  /// @dev tokenId zero is the protocol accumulator. tokenId equal to type(uint256).max requests a mint to recipient.\n  /// @param tokenId Target tokenId or sentinel (0 for accumulator, type(uint256).max for mint).\n  /// @param amount Underlying amount moved against tokenId.\n  /// @param recipient Owner assigned to a freshly minted sAERO when tokenId is the mint sentinel; ignored otherwise.\n  struct DestinationDelta {\n    uint256 tokenId;\n    uint128 amount;\n    address recipient;\n  }\n\n  /// @notice Contract dependencies wired at construction.\n  /// @param token ERC20 token escrowed by the contract.\n  /// @param voter Voter the escrow mirrors chain0 ledger moves onto.\n  /// @param artProxy Initial art proxy used by tokenURI.\n  /// @param voterPaymentsModule Initial module authorized to rebalance stake.\n  struct Contracts {\n    address token;\n    address voter;\n    address artProxy;\n    address voterPaymentsModule;\n  }\n\n  /// @notice Initial holders of the escrow administration and fee-burning roles.\n  /// @param vpmAdmin Address granted VPM_ADMIN_ROLE.\n  /// @param artProxyAdmin Address granted ART_PROXY_ADMIN_ROLE.\n  /// @param burnFeesAdmin Address granted BURN_FEES_ADMIN_ROLE.\n  /// @param feesBurner Address granted BURN_FEES_ROLE, or zero when unassigned.\n  struct Admins {\n    address vpmAdmin;\n    address artProxyAdmin;\n    address burnFeesAdmin;\n    address feesBurner;\n  }\n\n  /// @notice Emitted when a deposit is recorded against a tokenId.\n  /// @param provider Address that funded the deposit.\n  /// @param tokenId tokenId that received the deposit.\n  /// @param depositType Kind of deposit performed.\n  /// @param value Amount deposited.\n  /// @param unstakeTime Updated unstake timestamp.\n  /// @param ts Block timestamp at which the event was emitted.\n  event Deposit(\n    address indexed provider,\n    uint256 indexed tokenId,\n    DepositType indexed depositType,\n    uint128 value,\n    uint256 unstakeTime,\n    uint256 ts\n  );\n\n  /// @notice Emitted when the protocol burns amount of the underlying TOKEN held at the accumulator.\n  /// @param amount Amount of TOKEN destroyed.\n  event Burn(uint128 amount);\n\n  /// @notice Emitted when an expired stake is withdrawn.\n  /// @param provider Address that withdrew the underlying tokens.\n  /// @param tokenId tokenId whose staked balance was zeroed.\n  /// @param value Amount withdrawn.\n  /// @param ts Block timestamp at which the event was emitted.\n  event Withdraw(address indexed provider, uint256 indexed tokenId, uint128 value, uint256 ts);\n\n  /// @notice Emitted when a stake is converted to permanent mode.\n  /// @param owner Owner of the tokenId.\n  /// @param tokenId tokenId switched to permanent mode.\n  /// @param amount Amount counted as permanent.\n  /// @param ts Block timestamp at which the event was emitted.\n  event UpgradeToPermanentStake(address indexed owner, uint256 indexed tokenId, uint128 amount, uint256 ts);\n\n  /// @notice Emitted when a permanent stake is converted back to decay mode.\n  /// @param owner Owner of the tokenId.\n  /// @param tokenId tokenId switched out of permanent mode.\n  /// @param amount Amount removed from the permanent balance.\n  /// @param ts Block timestamp at which the event was emitted.\n  event DowngradeFromPermanentStake(address indexed owner, uint256 indexed tokenId, uint128 amount, uint256 ts);\n\n  /// @notice Emitted when the total supply tracked by the contract changes.\n  /// @param supply Total supply after the change.\n  event Supply(uint128 supply);\n\n  /// @notice Emitted when a VPM-initiated rebalance moves staking weight between sTokens.\n  /// @param sources Source deltas processed by the rebalance, in input order.\n  /// @param destinations Destination deltas processed by the rebalance, in input order.\n  event Rebalance(SourceDelta[] sources, DestinationDelta[] destinations);\n\n  /// @notice Emitted when the art proxy contract is updated.\n  /// @param newProxy New art proxy address.\n  event ArtProxyUpdated(address indexed newProxy);\n\n  /// @notice Thrown when a rebalance routes the protocol accumulator (tokenId 0) as a source.\n  ///         The accumulator is destroyed exclusively through `burn`.\n  error AccumulatorCannotBeSource();\n\n  /// @notice Thrown when burn is called with an amount exceeding the accumulator's staked balance.\n  error AmountExceedsAccumulator();\n\n  /// @notice Thrown when a stake amount credit would exceed `type(int128).max`, the implicit cap required\n  ///         for the value to round-trip through the signed slope/bias math during a future downgrade.\n  ///         Without this guard a deposit between `type(int128).max + 1` and `type(uint128).max` succeeds\n  ///         while permanent but cannot be downgraded to decay, leaving funds stuck.\n  error AmountExceedsCap();\n\n  /// @notice Thrown when a rebalance source delta exceeds the stake amount on its tokenId.\n  /// @param tokenId tokenId whose source delta exceeds the staked amount.\n  error AmountExceedsStake(uint256 tokenId);\n\n  /// @notice Thrown when the sum of source deltas does not equal the sum of destination deltas in a rebalance.\n  error BalanceMismatch();\n\n  /// @notice Thrown when a rebalance leg that is not a mint (tokenId != type(uint256).max) carries a nonzero recipient.\n  /// @param tokenId tokenId of the offending leg.\n  error NonMintRecipientNotAllowed(uint256 tokenId);\n\n  /// @notice Thrown when a historical query is given a timestamp after the current block.\n  /// @param timestamp The future timestamp that was queried.\n  /// @param clock The current clock value at query time.\n  error FutureLookup(uint256 timestamp, uint48 clock);\n\n  /// @notice Thrown when the provided signature nonce does not match the expected nonce.\n  error InvalidNonce();\n\n  /// @notice Thrown when an ECDSA signature recovery returns the zero address.\n  error InvalidSignature();\n\n  /// @notice Thrown when the s component of an ECDSA signature lies in the upper half order.\n  error InvalidSignatureS();\n\n  /// @notice Thrown when the requested staking period resolves to the current block or earlier.\n  error StakingPeriodNotInFuture();\n\n  /// @notice Thrown when the requested staking period exceeds MAXTIME.\n  error StakingPeriodTooLong();\n\n  /// @notice Thrown when a permanent stake is requested with a non-zero staking period.\n  error StakingPeriodNotAllowed();\n\n  /// @notice Thrown when the stake has already expired.\n  error StakeExpired();\n\n  /// @notice Thrown when reviving a token that still holds a funded stake.\n  error StakeAlreadyFunded();\n\n  /// @notice Thrown when extending a stake that holds no funds; `reviveStake` rebuilds it instead.\n  error StakeNotFunded();\n\n  /// @notice Thrown when the stake has not yet expired.\n  error StakeNotExpired();\n\n  /// @notice Thrown when the operation requires the stake to be permanent and it is not.\n  error NotPermanentStake();\n\n  /// @notice Thrown when `rebalanceUnderlying` is called by an address that does not hold VPM_ROLE.\n  error NotVoterPaymentsModule();\n\n  /// @notice Thrown when ownership changed in the current block, blocking the operation.\n  error OwnershipChange();\n\n  /// @notice Thrown when the operation cannot be performed on a permanent stake.\n  error PermanentStake();\n\n  /// @notice Thrown when the signature expiry has passed.\n  error SignatureExpired();\n\n  /// @notice Thrown when a rebalance destination has an earlier unlock than the latest source unlock.\n  error UnlockTimeReduction();\n\n  /// @notice Thrown when a required address argument is the zero address.\n  error ZeroAddress();\n\n  /// @notice Thrown when a required amount argument is zero.\n  error ZeroAmount();\n\n  /*//////////////////////////////////////////////////////////////\n                          STATE-CHANGING FUNCTIONS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Set a new art proxy contract.\n  /// @dev Callable only by holders of ART_PROXY_ADMIN_ROLE.\n  /// @param _proxy Address of the new art proxy contract.\n  function setArtProxy(address _proxy) external;\n\n  /// @notice Record global data to checkpoint.\n  function checkpoint() external;\n\n  /// @notice Deposit _value tokens for msg.sender and stake for _stakingWeeks weeks, or permanently if\n  ///         _isPermanent is true.\n  /// @dev Reverts with StakingPeriodNotAllowed when _isPermanent is true and _stakingWeeks is non-zero,\n  ///      so callers cannot silently provide an unused period on a permanent stake.\n  /// @param _value Amount to deposit.\n  /// @param _stakingWeeks Number of weeks to stake tokens for. Must be zero when _isPermanent is true.\n  /// @param _isPermanent If true, create the stake directly in permanent mode with no expiry.\n  /// @return _tokenId tokenId of the created sToken.\n  function createStake(uint128 _value, uint48 _stakingWeeks, bool _isPermanent) external returns (uint256 _tokenId);\n\n  /// @notice Rebuild an empty shell's stake from scratch, reusing its tokenId: deposit _value and stake for\n  ///         _stakingWeeks weeks, or permanently if _isPermanent is true.\n  /// @dev Only an empty shell whose stake is over qualifies — withdrawn, or fully drained past its end. Reverts\n  ///      `StakeAlreadyFunded` on a funded position (those move through the increase/upgrade paths, keeping their\n  ///      committed shape), `PermanentStake`/`StakeNotExpired` while the shell's stake is not over, and\n  ///      `StakingPeriodNotAllowed` when _isPermanent is true and _stakingWeeks is non-zero.\n  /// @param _tokenId sToken whose stake is being rebuilt.\n  /// @param _value Amount to deposit.\n  /// @param _stakingWeeks Number of weeks to stake tokens for. Must be zero when _isPermanent is true.\n  /// @param _isPermanent If true, rebuild the stake directly in permanent mode with no expiry.\n  function reviveStake(uint256 _tokenId, uint128 _value, uint48 _stakingWeeks, bool _isPermanent) external;\n\n  /// @notice Deposit _value additional tokens for _tokenId without modifying the staking period.\n  /// @dev Only the owner or an approved operator may call this.\n  /// @param _tokenId tokenId to deposit into.\n  /// @param _value Amount of tokens to deposit and add to the stake.\n  function increaseStakeAmount(uint256 _tokenId, uint128 _value) external;\n\n  /// @notice Extend the staking period for _tokenId. Cannot extend permanent stakes.\n  /// @dev Re-anchors the Voter's recorded stake shape to the new end through `IVoter.parkOnChain0`, so the Voter's\n  ///      ledger keeps mirroring the live stake with no re-vote.\n  /// @dev Reverts `StakeNotFunded` on an empty shell: there is no period to extend, `reviveStake` rebuilds it.\n  /// @param _tokenId tokenId to extend.\n  /// @param _stakingWeeks New number of weeks until the stake ends.\n  function increaseStakingPeriod(uint256 _tokenId, uint48 _stakingWeeks) external;\n\n  /// @notice Withdraw the underlying TOKEN for an expired decay sToken to `_recipient`.\n  /// @dev Callable by the tokenId's owner or an approved operator. The whole stake must already sit on the\n  ///      Voter's `CHAIN0`: voting power still booked on a remote chain must be returned first (a leaf-first\n  ///      `deallocate`, or `emergencyDeallocate` for a suspended chain), else this reverts\n  ///      `IVoter.InsufficientChain0Allocation`. This keeps root and every leaf agreeing the token holds nothing\n  ///      on their chain before the Voter ledger is cleared. Zeroes `_staked[_tokenId]` but does not destroy the\n  ///      NFT: the tokenId persists at zero balance with its owner intact, per the ownership-preserving-zeroing\n  ///      invariant.\n  /// @param _tokenId tokenId whose staked TOKEN is withdrawn.\n  /// @param _recipient Address that receives the released TOKEN.\n  function withdraw(uint256 _tokenId, address _recipient) external;\n\n  /// @notice Upgrade a decaying sToken to a permanent stake. Staking weight will be equal to `StakedBalance.amount`\n  ///         with no decay. Required to delegate.\n  /// @dev Only callable on decaying sTokens that have not yet expired.\n  /// @dev Re-anchors the Voter's recorded stake shape to the permanent one through `IVoter.parkOnChain0`, so the\n  ///      Voter's ledger keeps mirroring the live stake with no re-vote.\n  /// @param _tokenId tokenId to convert to permanent.\n  function upgradeToPermanentStake(uint256 _tokenId) external;\n\n  /// @notice Convert a permanent sToken back to decay mode with end = (now + MAXTIME) week-aligned.\n  /// @dev Callable by the tokenId's owner or an approved operator. Requires the token's full balance to sit idle\n  ///      on the Voter's chain0 (no cross-chain allocations), else reverts `IVoter.InsufficientChain0Allocation`;\n  ///      deallocate with an empty `Voter.vote` first and re-vote afterwards. Subtracts the stake amount from\n  ///      permanentStakeBalance, clears delegation, and schedules a new slope change.\n  /// @param _tokenId tokenId to downgrade from permanent.\n  function downgradeFromPermanentStake(uint256 _tokenId) external;\n\n  /// @notice Move staking weight between sTokens in a single atomic operation.\n  /// @dev Callable by any VPM_ROLE holder. The VPM must itself be authorized (operator or token approval) by each\n  ///      source's owner, else the call reverts with the ERC721 approval error.\n  ///      Sources reduce stake amounts and update the permanent pool\n  ///      when permanent. Destinations route the moved amount to the protocol accumulator (tokenId zero), a freshly\n  ///      minted sToken (tokenId equal to type(uint256).max), or an existing sToken. Enforces sum(sources) ==\n  ///      sum(destinations) and the monotonic unlock rule: a destination unlock must not fall earlier than the latest\n  ///      source unlock, with permanent sources forcing every non-sentinel destination to be permanent. Mints use\n  ///      ERC721 _mint without the safe-mint receiver hook so VPM can predict the assigned IDs. After committing the\n  ///      moves, mirrors them onto the Voter's chain0 ledger via `VOTER.rebalanceChain0`.\n  /// @param _sources Source deltas reducing stake balances.\n  /// @param _destinations Destination deltas applying the moved amount per destination mode.\n  /// @return _mintedIds tokenIds assigned to mint destinations, in input order.\n  function rebalanceUnderlying(\n    SourceDelta[] calldata _sources,\n    DestinationDelta[] calldata _destinations\n  ) external returns (uint256[] memory _mintedIds);\n\n  /// @notice Destroy _amount of the underlying TOKEN held at the protocol accumulator (tokenId 0).\n  /// @dev Callable only by a BURN_FEES_ROLE holder. Decrements the accumulator amount, supply,\n  ///      and permanentStakeBalance symmetrically, calls the TOKEN's burn, then burns the matching voting\n  ///      power on the Voter's chain0 (the accumulator's VP is always parked there) via `VOTER.burn`.\n  /// @param _amount Amount of TOKEN to destroy.\n  function burnFees(uint128 _amount) external;\n\n  /// @inheritdoc IVotes\n  function delegate(uint256 _delegator, uint256 _delegatee) external;\n\n  /// @inheritdoc IVotes\n  function delegateBySig(\n    uint256 _delegator,\n    uint256 _delegatee,\n    uint256 _nonce,\n    uint256 _expiry,\n    uint8 _v,\n    bytes32 _r,\n    bytes32 _s\n  ) external;\n\n  /*//////////////////////////////////////////////////////////////\n                             VIEW FUNCTIONS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Role marker held by every VoterPaymentsModule that VotingEscrow recognises.\n  /// @return _role Role identifier.\n  function VPM_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Admin role for VPM_ROLE. Holders can grant or revoke VPM_ROLE.\n  /// @return _role Role identifier.\n  function VPM_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Role required to call `burnFees`.\n  /// @return _role Role identifier.\n  function BURN_FEES_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Admin role for BURN_FEES_ROLE. Holders can grant or revoke BURN_FEES_ROLE.\n  /// @return _role Role identifier.\n  function BURN_FEES_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice Role allowed to set the art proxy contract.\n  /// @return _role Role identifier.\n  function ART_PROXY_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice EIP-712 typehash for the delegation struct used in delegateBySig.\n  /// @return _typehash Delegation typehash.\n  function DELEGATION_TYPEHASH() external view returns (bytes32 _typehash);\n\n  /// @notice Underlying token escrowed to create sAEROs.\n  /// @return _token The escrowed token.\n  function TOKEN() external view returns (IToken _token);\n\n  /// @notice Immutable Voter that VotingEscrow mirrors rebalance moves onto via `rebalanceChain0`.\n  /// @return _voter The bound Voter.\n  function VOTER() external view returns (IVoter _voter);\n\n  /// @notice Address of the art proxy used for on-chain metadata.\n  /// @return _proxy Art proxy address.\n  function artProxy() external view returns (address _proxy);\n\n  /// @notice Latest tokenId minted; doubles as the monotonic ID counter.\n  /// @return _tokenId Latest tokenId.\n  function tokenId() external view returns (uint256 _tokenId);\n\n  /// @notice Version tag of the contract.\n  /// @return _version Version string.\n  function VERSION() external view returns (string memory _version);\n\n  /// @notice Whether the given address is authorized as a VoterPaymentsModule.\n  /// @param _account Candidate address to check.\n  /// @return _authorized True when _account holds VPM_ROLE.\n  function isAuthorizedVPM(address _account) external view returns (bool _authorized);\n\n  /// @notice Whether a VoterPaymentsModule may operate on a specific tokenId at the VotingEscrow layer.\n  /// @dev True when `_vpm` holds VPM_ROLE and is ERC-721 authorized for the token; nonexistent token returns false.\n  /// @param _vpm Candidate VoterPaymentsModule address.\n  /// @param _tokenId tokenId being targeted.\n  /// @return _authorized True when the VPM is authorized for this tokenId.\n  function isAuthorizedVPMForToken(address _vpm, uint256 _tokenId) external view returns (bool _authorized);\n\n  /// @notice Total count of global checkpoints recorded since contract creation.\n  /// @return _epoch Latest global epoch.\n  function epoch() external view returns (uint256 _epoch);\n\n  /// @notice Total amount of underlying token currently held in escrow.\n  /// @return _supply Total supply.\n  function supply() external view returns (uint128 _supply);\n\n  /// @notice Aggregate balance held in permanent stakes.\n  /// @return _permanent Aggregate permanent staked balance.\n  function permanentStakeBalance() external view returns (uint128 _permanent);\n\n  /// @notice Latest checkpoint epoch recorded for a given tokenId.\n  /// @param _tokenId tokenId to query.\n  /// @return _epoch Latest user checkpoint epoch.\n  function userPointEpoch(uint256 _tokenId) external view returns (uint256 _epoch);\n\n  /// @notice Scheduled signed slope change at a given timestamp.\n  /// @param _timestamp Timestamp to query.\n  /// @return _slopeChange Signed slope delta scheduled at the timestamp.\n  function slopeChanges(uint48 _timestamp) external view returns (int128 _slopeChange);\n\n  /// @notice Global checkpoint history at a given epoch index.\n  /// @param _loc Global epoch index.\n  /// @return _point Global checkpoint snapshot.\n  function pointHistory(uint256 _loc) external view returns (GlobalPoint memory _point);\n\n  /// @notice Get the StakedBalance (amount, end, isPermanent) for a tokenId.\n  /// @dev tokenId 0 is the protocol accumulator, a permanent position from deployment.\n  /// @param _tokenId tokenId to query.\n  /// @return _staked StakedBalance for the tokenId.\n  function staked(uint256 _tokenId) external view returns (StakedBalance memory _staked);\n\n  /// @notice User checkpoint history for a given tokenId and index.\n  /// @param _tokenId tokenId to query.\n  /// @param _loc User epoch index.\n  /// @return _point User checkpoint snapshot.\n  function userPointHistory(uint256 _tokenId, uint256 _loc) external view returns (UserPoint memory _point);\n\n  /// @notice Get the voting power for _tokenId at the current timestamp.\n  /// @param _tokenId tokenId to query.\n  /// @return _balance Voting power at the current timestamp.\n  function balanceOfNFT(uint256 _tokenId) external view returns (uint256 _balance);\n\n  /// @notice Get the voting power for _tokenId at a given timestamp.\n  /// @param _tokenId tokenId to query.\n  /// @param _t Timestamp to query voting power at.\n  /// @return _balance Voting power at the given timestamp.\n  function balanceOfNFTAt(uint256 _tokenId, uint256 _t) external view returns (uint256 _balance);\n\n  /// @notice Check whether spender is owner or an approved user for a given sAERO.\n  /// @param _spender Caller to check.\n  /// @param _tokenId tokenId to check authorization for.\n  /// @return _approved True if the spender is authorized.\n  function isAuthorized(address _spender, uint256 _tokenId) external view returns (bool _approved);\n\n  /// @notice Total number of sTOKENs in existence.\n  /// @return _supply Number of sTOKENs minted.\n  function totalSupply() external view override(IERC721Enumerable) returns (uint256 _supply);\n\n  /// @notice Calculate total voting power at current timestamp.\n  /// @return _votingPower Total voting power at the current timestamp.\n  function totalVotingPower() external view returns (uint256 _votingPower);\n\n  /// @notice Calculate total voting power at a given timestamp.\n  /// @param _t Timestamp to query total voting power at.\n  /// @return _votingPower Total voting power at the given timestamp.\n  function totalVotingPowerAt(uint256 _t) external view returns (uint256 _votingPower);\n\n  /// @notice Block in which a tokenId's ownership last changed; used for the same-block delegation guard.\n  /// @dev Returns 0 for tokens that have never been transferred or have not changed ownership.\n  /// @param _tokenId tokenId to query.\n  /// @return _block Block number of the last ownership change.\n  function ownershipChange(uint256 _tokenId) external view returns (uint256 _block);\n\n  /// @notice The number of delegation checkpoints recorded for each tokenId.\n  /// @param _tokenId tokenId to query.\n  /// @return _count Number of recorded checkpoints.\n  function numCheckpoints(uint256 _tokenId) external view returns (uint48 _count);\n\n  /// @notice Signature nonce for the given account.\n  /// @param _account Account to query.\n  /// @return _nonce Current nonce.\n  function nonces(address _account) external view returns (uint256 _nonce);\n\n  /// @inheritdoc IVotes\n  function delegates(uint256 _delegator) external view returns (uint256);\n\n  /// @notice A record of delegated token checkpoints for each account, by index.\n  /// @param _tokenId tokenId to query.\n  /// @param _index Checkpoint index to query.\n  /// @return _checkpoint Recorded checkpoint.\n  function checkpoints(uint256 _tokenId, uint48 _index) external view returns (Checkpoint memory _checkpoint);\n\n  /// @inheritdoc IVotes\n  function getPastVotes(address _account, uint256 _tokenId, uint256 _timestamp) external view returns (uint256);\n\n  /// @inheritdoc IVotes\n  function getPastTotalSupply(uint256 _timestamp) external view returns (uint256);\n\n  /// @inheritdoc IERC6372\n  function clock() external view returns (uint48);\n\n  /// @inheritdoc IERC6372\n  function CLOCK_MODE() external view returns (string memory);\n}\n"},"V3/src/interfaces/governor/IGovernor.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title  IGovernor\n * @notice Minimal surface of the tokenId-keyed Governor the Relay forwards fractional votes to. The\n *         real Governor (GovernorSimple + fractional counting) exposes far more; the Relay only needs\n *         the proposal snapshot and the parameterized cast.\n */\ninterface IGovernor {\n  /**\n   * @notice Cast a vote for `_tokenId` with a reason and counting-module params (fractional support).\n   * @param _proposalId Proposal being voted on.\n   * @param _tokenId sAERO whose voting power backs the cast; the caller must be its owner or approved.\n   * @param _support Counting-module support: 0 Against, 1 For, 2 Abstain, 255 fractional.\n   * @param _reason Free-form reason string attached to the cast.\n   * @param _params Counting-module params; for fractional support, three packed `uint128` weights\n   *        (against, for, abstain).\n   * @return _weight Voting weight the Governor consumed for this cast.\n   */\n  function castVoteWithReasonAndParams(\n    uint256 _proposalId,\n    uint256 _tokenId,\n    uint8 _support,\n    string calldata _reason,\n    bytes memory _params\n  ) external returns (uint256 _weight);\n\n  /**\n   * @notice Timepoint (EIP-6372 timestamp mode) at which voting power for a proposal is snapshotted.\n   * @param _proposalId Proposal being queried.\n   * @return _snapshot The proposal's snapshot timestamp.\n   */\n  function proposalSnapshot(uint256 _proposalId) external view returns (uint256 _snapshot);\n}\n"},"V3/src/interfaces/voter/IVoterCommon.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IVoterCommon\n * @notice Types shared by `IVoter` (root) and `ILeafVoter` (leaf), so the same struct crosses chains unchanged.\n */\ninterface IVoterCommon {\n  /*//////////////////////////////////////////////////////////////\n                                  ENUMS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Per-chain operational status shared by root and leaf voters.\n   * @dev `None` is the enum default (0), so an unregistered chain never passes a status check; registration\n   *      (root) and construction (leaf) set `Active`, and `setChainStatus` cannot set `None`. `Active` allows\n   *      everything, `Paused` blocks the chain's operations.\n   * @dev `Suspended` is the emissions kill switch: root rejects inbound messages and sends the chain's accrual to\n   *      surplus, the leaf blocks outbound dispatch and user entrypoints but still applies root messages at rate\n   *      zero, so its mirror repairs itself without accruing unfunded emissions.\n   * @dev `Sunset` is the wind-down. Root stops accepting chain allocations, sends the chain's accrual to\n   *      surplus like `Suspended`, and keeps processing redeems and deallocations. Gauge votes, operator\n   *      updates and cooldown reductions still dispatch so booked voting power can exit through `DEALLOC_GAUGE`;\n   *      the chain accrues nothing, so they move no emissions. The leaf parks its scalar at zero but keeps\n   *      `allocateGauges`, `mintEmissions` and `redeem` open, so everything already earned stays claimable and\n   *      redeemable. Its only exit is `Suspended`, the kill switch for a compromised or unreachable sunset\n   *      chain and the mandatory first leg of a reactivation (see `IVoter.setChainStatus`).\n   * @param None Uninitialized sentinel, the state of an unregistered chain.\n   * @param Active Fully operational.\n   * @param Paused Chain operations blocked on both sides; accrual continues.\n   * @param Suspended Emissions kill switch; accrual goes to surplus and user entrypoints close.\n   * @param Sunset Wind-down; accrual goes to surplus, exits stay open, chain allocations close.\n   */\n  enum ChainStatus {\n    None,\n    Active,\n    Paused,\n    Suspended,\n    Sunset\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /**\n   * @notice Snapshot of decaying voting power at a point in time.\n   * @param bias Current voting power; decays linearly.\n   * @param slope Rate of decay per second.\n   * @param ts Timestamp of last resolution.\n   * @param permanentStakeBalance Non-decaying voting power from permanent stakes.\n   */\n  struct Point {\n    int128 bias;\n    int128 slope;\n    uint48 ts;\n    uint128 permanentStakeBalance;\n  }\n\n  /**\n   * @notice One gauge leg of a tokenId's vote. Sent to the leaf in the dispatch payload; root keeps no copy.\n   * @param gauge Target gauge address.\n   * @param allocated Absolute AERO for this gauge, not a percentage; Σ within a chain equals that chain's total.\n   * @param data Opaque per-gauge payload forwarded unchanged to the leaf.\n   */\n  struct GaugeAllocation {\n    address gauge;\n    uint128 allocated;\n    bytes data;\n  }\n\n  /**\n   * @notice VE state at dispatch, so the leaf can rebuild the tokenId's contribution shape locally.\n   * @dev The leaf derives bias, slope and permanent balance from `_contribution(allocated, stakeEnd, isPermanent)`,\n   *      settled at its own `block.timestamp`. `isPermanent` is the permanence discriminator, not `stakeEnd == 0`.\n   * @param staked AERO staked in the veNFT at dispatch time.\n   * @param stakeEnd Week-aligned stake expiry; `0` for a permanent stake.\n   * @param isPermanent True for a permanent stake; the permanence signal the leaf reads.\n   */\n  struct TokenSnapshot {\n    uint128 staked;\n    uint48 stakeEnd;\n    bool isPermanent;\n  }\n\n  /**\n   * @notice Chain-level allocation from root to a leaf: sets the tokenId's budget on the chain and the chain's\n   *         emissions scalar. No gauges and no cooldown — chain assignment always applies.\n   * @dev Applied additively on the leaf, so it can never bring back a budget the leaf-first `deallocate` removed.\n   *      Reductions go leaf-first through `deallocate`, never through this message.\n   * @dev The MessageOrchestrator stamps `chainNonce` and `dispatchedAt` and wraps every message body below in\n   *      the `(MessageType, chainNonce, dispatchedAt, bytes)` transport envelope; these structs are the\n   *      Voter→Orchestrator body only.\n   * @param tokenId Originating tokenId.\n   * @param allocationDelta Voting power added to the token's budget here, drawn from `CHAIN0`; always an increase.\n   * @param emissionsPerVP Global emissions per unit voting power, `PRECISION`-scaled; the leaf's index rate.\n   * @param snapshot Live VE shape at dispatch, which anchors the token's booked shape on the leaf.\n   */\n  struct AllocateChainMessage {\n    uint256 tokenId;\n    uint128 allocationDelta;\n    uint256 emissionsPerVP;\n    TokenSnapshot snapshot;\n  }\n\n  /**\n   * @notice Gauge distribution from root to a leaf, spreading the tokenId's chain budget across gauges.\n   * @dev Cooldown-gated on the leaf: it reverts while the cooldown still runs and the transport redelivers later.\n   * @param tokenId Originating tokenId.\n   * @param expiry Absolute deadline stamped by root; past it the leaf reverts `AllocationExpired`.\n   * @param emissionsPerVP Emissions per unit voting power, `PRECISION`-scaled; only the leaf's newest message\n   *                       refreshes its scalar.\n   * @param tokenSnapshot Live VE state at dispatch, used to shape each gauge's contribution.\n   * @param allocations Per-gauge allocations on this chain. Empty clears the tokenId's gauge weight.\n   */\n  struct AllocateGaugeMessage {\n    uint256 tokenId;\n    uint48 expiry;\n    uint256 emissionsPerVP;\n    TokenSnapshot tokenSnapshot;\n    GaugeAllocation[] allocations;\n  }\n\n  /**\n   * @notice Cooldown reduction from root to a leaf. The leaf accrues it and the token's next gauge allocation,\n   *         bridged or local, spends it clamped to `allocationCooldown`.\n   * @dev Reductions accrue additively, so message order does not matter and no reduction-specific nonce gate is\n   *      needed; the global replay gate applies each one exactly once.\n   * @param tokenId veNFT id whose pending cooldown reduction is being increased.\n   * @param reduction Seconds added to the tokenId's pending cooldown reduction on this chain.\n   */\n  struct ReduceCooldownMessage {\n    uint256 tokenId;\n    uint48 reduction;\n  }\n\n  /**\n   * @notice Emergency unwind from root to a leaf after root drained `amount` from a `Suspended` chain: the leaf\n   *         clears the tokenId's gauges and re-parks the remaining budget (`budget - amount`) on `ZERO_GAUGE`.\n   * @dev It subtracts a fixed amount instead of zeroing, so `AllocateChain` deltas booked before the drain need\n   *      no ordering gate; the leaf drops stale pre-drain deltas by message nonce.\n   * @dev It over-subtracts if a POST-resume delta lands first, so resume is gated on delivery — see the\n   *      precondition on `IVoter.setChainStatus`.\n   * @param tokenId veNFT id whose position on the chain is being reduced.\n   * @param amount Chain budget root drained to `CHAIN0`; the leaf subtracts it, clamped at zero.\n   */\n  struct EmergencyDeallocateMessage {\n    uint256 tokenId;\n    uint128 amount;\n  }\n\n  /**\n   * @notice Redeem payload dispatched from a leaf to root.\n   * @param amount Amount of `ReceiptToken` burned on the leaf and `TOKEN` to mint on root.\n   * @param recipient Address that receives the minted `TOKEN` on root.\n   * @param surplusAccrued Cumulative surplus accumulator snapshot reported by the leaf.\n   */\n  struct RedeemMessageBody {\n    uint256 amount;\n    address recipient;\n    uint256 surplusAccrued;\n  }\n\n  /**\n   * @notice Deallocation confirmation from a leaf to root, so root credits `CHAIN0` only once the leaf confirms.\n   * @param tokenId veNFT id whose voting power was deallocated on the leaf.\n   * @param amount Voting power deallocated on the leaf, to credit back to `CHAIN0` on root.\n   */\n  struct DeallocationMessageBody {\n    uint256 tokenId;\n    uint128 amount;\n  }\n\n  /**\n   * @notice Operator assignment from root to a leaf, keeping the leaf's `operators[tokenId]` mirror in sync.\n   * @param tokenId veNFT id whose operator is being set.\n   * @param expiry Absolute deadline stamped by root; past it the leaf drops the message with\n   * `ExpiredMessageDropped`.\n   * @param operator New operator address. Zero clears the slot.\n   */\n  struct OperatorMessage {\n    uint256 tokenId;\n    uint48 expiry;\n    address operator;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when `setChainStatus` is called with the chain's current status, a no-op write.\n  error ChainStatusUnchanged();\n\n  /**\n   * @notice Thrown when `setChainStatus` moves a `Suspended` chain to `Paused`, or a `Sunset` chain to\n   *         anything but `Suspended`. A `None` target reverts with `InvalidStatus` first.\n   * @dev A `Paused` exit restarts ceiling accrual at the stored rate while the leaf still distributes nothing,\n   *      and `Paused` blocks the vote pipeline, so no message could resync the leaf for that whole period.\n   *      `Sunset` exits only through `Suspended`, so a reactivation always drains the in-flight deallocation\n   *      set before any resume and a dead sunset chain keeps its kill switch.\n   */\n  error InvalidChainStatusTransition();\n\n  /// @notice Thrown when `setChainStatus` is called with `None`, the uninitialized sentinel status.\n  error InvalidStatus();\n\n  /// @notice Thrown when a constructor receives a zero address argument.\n  error ZeroAddress();\n\n  /// @notice Thrown when the token's stake is expired.\n  error StakeExpired();\n\n  /// @notice Thrown when a vote on a sunset chain carries anything but the lone `DEALLOC_GAUGE` return.\n  error SunsetDeallocOnly();\n\n  /// @notice Thrown when an allocation entry carries a zero `allocated` amount.\n  error ZeroAllocation();\n\n  /// @notice Thrown when `msg.value` is attached but there is no return message to fund.\n  error UnexpectedValue();\n\n  /// @notice Thrown when an allocation's gauges are not strictly ascending by address, which also rejects\n  ///         duplicates.\n  error GaugesNotStrictlyAscending();\n}\n"},"V3/src/metarouter/libraries/Commands.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\n/**\n * @title Commands\n * @notice Command IDs and command-byte encoding constants used by the Metarouter.\n */\nlibrary Commands {\n  /// Payments\n  /**\n   * @notice Transfers a full execution-address balance with a minimum floor.\n   * @return The SWEEP command ID.\n   */\n  uint256 public constant SWEEP = 0x04;\n\n  /**\n   * @notice Transfers a balance portion selected with `Amount` or `Pips` to a recipient.\n   * @return The TRANSFER command ID.\n   */\n  uint256 public constant TRANSFER = 0x05;\n\n  /**\n   * @notice Wraps an `Amount` or `Pips` portion of the available native ETH.\n   * @return The WRAP_ETH command ID.\n   */\n  uint256 public constant WRAP_ETH = 0x0b;\n\n  /**\n   * @notice Unwraps a WETH balance portion selected with `Amount` or `Pips` and sends ETH to a recipient.\n   * @return The UNWRAP_WETH command ID.\n   */\n  uint256 public constant UNWRAP_WETH = 0x0c;\n\n  /**\n   * @notice Pulls an `Amount` or `Pips` share of `msgSender()`'s balance into the execution address.\n   * @return The FUND_ERC20 command ID.\n   */\n  uint256 public constant FUND_ERC20 = 0x0f;\n\n  /**\n   * @notice Transfers an NFT held in batch custody to a recipient.\n   * @dev Sits at the tail of the ID sequence because new IDs extend it; it belongs to this group.\n   * @return The TRANSFER_NFT command ID.\n   */\n  uint256 public constant TRANSFER_NFT = 0x34;\n\n  /// Swaps\n  /**\n   * @notice Executes an exact-input CL swap.\n   * @return The CL_SWAP_EXACT_IN command ID.\n   */\n  uint256 public constant CL_SWAP_EXACT_IN = 0x00;\n\n  /**\n   * @notice Executes an exact-output CL swap.\n   * @return The CL_SWAP_EXACT_OUT command ID.\n   */\n  uint256 public constant CL_SWAP_EXACT_OUT = 0x01;\n\n  /**\n   * @notice Executes an exact-input V2 swap.\n   * @return The V2_SWAP_EXACT_IN command ID.\n   */\n  uint256 public constant V2_SWAP_EXACT_IN = 0x08;\n\n  /**\n   * @notice Executes an exact-output V2 swap.\n   * @return The V2_SWAP_EXACT_OUT command ID.\n   */\n  uint256 public constant V2_SWAP_EXACT_OUT = 0x09;\n\n  /// V2 liquidity\n  /**\n   * @notice Adds liquidity and mints LP tokens.\n   * @return The ADD_LIQUIDITY command ID.\n   */\n  uint256 public constant ADD_LIQUIDITY = 0x22;\n\n  /**\n   * @notice Burns LP tokens for the underlying assets.\n   * @return The REMOVE_LIQUIDITY command ID.\n   */\n  uint256 public constant REMOVE_LIQUIDITY = 0x23;\n\n  /// CL positions\n  /**\n   * @notice Mints a new CL position.\n   * @return The MINT_CL_POSITION command ID.\n   */\n  uint256 public constant MINT_CL_POSITION = 0x24;\n\n  /**\n   * @notice Adds liquidity to a position.\n   * @return The INCREASE_CL_LIQUIDITY command ID.\n   */\n  uint256 public constant INCREASE_CL_LIQUIDITY = 0x25;\n\n  /**\n   * @notice Removes liquidity from a position.\n   * @return The DECREASE_CL_LIQUIDITY command ID.\n   */\n  uint256 public constant DECREASE_CL_LIQUIDITY = 0x26;\n\n  /**\n   * @notice Collects tokens owed by a position.\n   * @return The COLLECT_CL_FEES command ID.\n   */\n  uint256 public constant COLLECT_CL_FEES = 0x27;\n\n  /**\n   * @notice Burns a CL position NFT after all liquidity and owed tokens have been removed.\n   * @return The BURN_CL_POSITION command ID.\n   */\n  uint256 public constant BURN_CL_POSITION = 0x28;\n\n  /// Staking\n  /**\n   * @notice Stakes an LP balance or CL position in a gauge.\n   * @return The STAKE_GAUGE command ID.\n   */\n  uint256 public constant STAKE_GAUGE = 0x29;\n\n  /**\n   * @notice Withdraws the caller's gauge stake.\n   * @return The UNSTAKE_GAUGE command ID.\n   */\n  uint256 public constant UNSTAKE_GAUGE = 0x2a;\n\n  /// Claims\n  /**\n   * @notice Claims the caller's gauge rewards.\n   * @return The CLAIM_GAUGE_REWARDS command ID.\n   */\n  uint256 public constant CLAIM_GAUGE_REWARDS = 0x2d;\n\n  /**\n   * @notice Claims V2 pool fees for the caller or the router.\n   * @return The CLAIM_V2_POOL_FEES command ID.\n   */\n  uint256 public constant CLAIM_V2_POOL_FEES = 0x2f;\n\n  /// Stake and relay\n  /**\n   * @notice Stakes TOKEN and creates an sAERO.\n   * @return The CREATE_STAKE command ID.\n   */\n  uint256 public constant CREATE_STAKE = 0x30;\n\n  /**\n   * @notice Deposits an existing sAERO into a relay.\n   * @return The DEPOSIT_RELAY command ID.\n   */\n  uint256 public constant DEPOSIT_RELAY = 0x32;\n\n  /// Cross-chain\n  /**\n   * @notice Bridges a supported token held by the execution address.\n   * @return The BRIDGE_TOKEN command ID.\n   */\n  uint256 public constant BRIDGE_TOKEN = 0x12;\n\n  /**\n   * @notice Dispatches a destination plan through ICA.\n   * @return The EXECUTE_CROSS_CHAIN command ID.\n   */\n  uint256 public constant EXECUTE_CROSS_CHAIN = 0x13;\n\n  /**\n   * @notice Burns held `ReceiptToken` on a leaf to mint `TOKEN` to a root recipient.\n   * @return The REDEEM command ID.\n   */\n  uint256 public constant REDEEM = 0x14;\n\n  /// Control flow\n  /**\n   * @notice Executes a catchable nested command list.\n   * @return The EXECUTE_SUB_PLAN command ID.\n   */\n  uint256 public constant EXECUTE_SUB_PLAN = 0x21;\n\n  /**\n   * @notice Reverts when an ERC20 or native balance is below a minimum.\n   * @dev Address zero selects native ETH.\n   * @return The BALANCE_CHECK command ID.\n   */\n  uint256 public constant BALANCE_CHECK = 0x0e;\n\n  /// Command-byte encoding\n  /**\n   * @notice High bit of a command byte; when set, marks the command as allow-revert.\n   * @dev The swallowed failure also covers a revert from an invalid or undefined command, not only a handler's\n   *      own failure.\n   * @return The allow-revert flag mask.\n   */\n  bytes1 public constant FLAG_ALLOW_REVERT = 0x80;\n\n  /**\n   * @notice Low seven bits of a command byte holding the command ID.\n   * @return The command-ID bit mask.\n   */\n  bytes1 public constant COMMAND_TYPE_MASK = 0x7f;\n}\n"},"V3/src/metarouter/libraries/FundsLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {Math} from '@openzeppelin/contracts/utils/math/Math.sol';\n\nimport {MAX_PIPS} from 'V3/libraries/ProtocolConstants.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title FundsLib\n * @notice Shared token funding and balance-resolution helpers for the Metarouter command libraries.\n * @dev All functions are internal, so they inline into the command library (or the router) that uses them and\n *      operate on the router's own storage/transient context. Logical-sender resolution and custody tracking are\n *      delegated to `MetarouterState`.\n */\nlibrary FundsLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Pushes tokens the execution address holds to a recipient.\n   * @dev Moves the router's own balance out, so custody never grows and nothing is tracked. For the native ERC20\n   *      token, the amount is bounded by the balance available to the batch so pre-batch native cannot be spent\n   *      through its ERC20 entry point.\n   * @param _token ERC20 to transfer.\n   * @param _recipient Address receiving the tokens.\n   * @param _amount Token amount to transfer.\n   */\n  function push(address _token, address _recipient, uint256 _amount) internal {\n    if (_token == MetarouterState.nativeErc20() && _amount > MetarouterState.availableErc20Balance(_token)) {\n      revert IMetarouter.InsufficientBalance(_token);\n    }\n    IERC20(_token).safeTransfer(_recipient, _amount);\n  }\n\n  /**\n   * @notice Pulls tokens from the logical sender into the execution address.\n   * @dev The source is always `msgSender()` and the destination is always the execution address, so no addresses are\n   *      passed and no authorization check is needed. The token lands in custody, so it is tracked for the closure\n   *      sweep.\n   * @param _token ERC20 to transfer.\n   * @param _amount Token amount to transfer.\n   */\n  function pull(address _token, uint256 _amount) internal {\n    MetarouterState.trackERC20(_token);\n    // slither-disable-next-line arbitrary-send-erc20\n    IERC20(_token).safeTransferFrom(MetarouterState.msgSender(), address(this), _amount);\n  }\n\n  /**\n   * @notice Pays a recipient from the execution address or the logical sender.\n   * @dev Execution-address payments use the custody-protected `push` boundary. Logical-sender payments transfer\n   *      directly from the authorized sender and do not spend router custody.\n   * @param _token ERC20 to transfer.\n   * @param _payer Authorized payer: the execution address or the logical sender.\n   * @param _recipient Address receiving the payment.\n   * @param _amount Token amount to transfer.\n   */\n  function pay(address _token, address _payer, address _recipient, uint256 _amount) internal {\n    if (_payer == address(this)) {\n      push(_token, _recipient, _amount);\n      return;\n    }\n    // The zero check keeps an unset logical sender from ever authorizing a pull.\n    if (_payer == address(0) || _payer != MetarouterState.msgSender()) revert IMetarouter.InvalidPayer();\n    // slither-disable-next-line arbitrary-send-erc20\n    IERC20(_token).safeTransferFrom(_payer, _recipient, _amount);\n  }\n\n  /**\n   * @notice Resolves held funds or pulls an exact amount from the logical sender.\n   * @dev External funding returns the received balance delta so fee-on-transfer inputs remain usable, and accepts\n   *      `Amount` only. An external pull is bounded by the caller's ERC20 approval, so an exact amount is the\n   *      meaningful unit; a percentage of a wallet has no clean meaning here. `Pips` applies only to the\n   *      execution-address balance (the internal path); wallet-percentage funding, if ever needed, is `FUND_ERC20`.\n   * @param _token ERC20 being funded.\n   * @param _spend Selection applied when spending the execution address's balance.\n   * @param _payerIsUser Whether to pull an exact amount from the logical sender instead of the execution balance.\n   * @return _amount Amount available to the command after funding.\n   */\n  function fund(\n    address _token,\n    IMetarouter.BalanceSpend memory _spend,\n    bool _payerIsUser\n  ) internal returns (uint256 _amount) {\n    if (_payerIsUser) {\n      if (_spend.mode != IMetarouter.SpendMode.Amount) revert IMetarouter.InvalidSpendMode();\n      uint256 _balanceBefore = IERC20(_token).balanceOf(address(this));\n      pull(_token, _spend.value);\n      _amount = IERC20(_token).balanceOf(address(this)) - _balanceBefore;\n    } else {\n      _amount = resolveSpend(_token, _spend);\n      MetarouterState.trackERC20(_token);\n    }\n  }\n\n  /**\n   * @notice Resolves a spend against the execution address's token balance available to the batch.\n   * @dev The available balance excludes the pre-batch native for the chain's native ERC20, whose `balanceOf`\n   *      is the execution address's native balance; every other token resolves against its full balance.\n   * @param _token ERC20 whose balance is being resolved.\n   * @param _spend Balance selection mode and value.\n   * @return _amount Token amount selected by the spend mode.\n   */\n  function resolveSpend(\n    address _token,\n    IMetarouter.BalanceSpend memory _spend\n  ) internal view returns (uint256 _amount) {\n    return resolveBalance(_token, MetarouterState.availableErc20Balance(_token), _spend);\n  }\n\n  /**\n   * @notice Resolves a spend against a supplied asset balance.\n   * @param _asset ERC20 address, or address(0) for native ETH.\n   * @param _balance Current balance available to spend.\n   * @param _spend Balance selection mode and value.\n   * @return _amount Asset amount selected by the spend mode.\n   */\n  function resolveBalance(\n    address _asset,\n    uint256 _balance,\n    IMetarouter.BalanceSpend memory _spend\n  ) internal pure returns (uint256 _amount) {\n    if (_spend.mode == IMetarouter.SpendMode.Amount) {\n      if (_spend.value > _balance) {\n        revert IMetarouter.InsufficientBalance(_asset);\n      }\n      return _spend.value;\n    }\n    // The only remaining variant is SpendMode.Pips; an out-of-range mode Panics when `_spend.mode` is read above.\n    if (_spend.value > MAX_PIPS) revert IMetarouter.InvalidPips(_spend.value);\n    return Math.mulDiv(_balance, _spend.value, MAX_PIPS);\n  }\n}\n"},"V3/src/metarouter/libraries/GaugeLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {ZERO_GAUGE} from 'V3/libraries/ProtocolConstants.sol';\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IGaugeFactory} from 'V3/interfaces/factories/IGaugeFactory.sol';\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\nimport {IV2Gauge} from 'V3/interfaces/gauges/IV2Gauge.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title GaugeLib\n * @notice Shared gauge introspection helpers for the Metarouter command libraries.\n * @dev Internal-only library: the helpers inline into each command library that uses them, so sharing them adds no\n *      linking or `DELEGATECALL` surface.\n */\nlibrary GaugeLib {\n  /// @notice Keccak hash of `'cl'`, the `GAUGE_TYPE()` string a concentrated-liquidity gauge factory reports.\n  bytes32 private constant _CL_GAUGE_TYPE_HASH = keccak256('cl');\n\n  /**\n   * @notice Reverts unless the gauge is a routable target registered with the Voter.\n   * @dev The Voter registers `ZERO_GAUGE` as the idle sink a vote parks power on, so registration alone does not make\n   *      a target routable. It is a bookkeeping key rather than a contract, and it is excluded here the way\n   *      `LeafVoter.activateGauge` excludes it.\n   * @param _gauge Gauge target to validate.\n   * @param _leafVoter Leaf Voter whose `gaugeStates` gates the target.\n   */\n  function requireRegisteredGauge(address _gauge, ILeafVoter _leafVoter) internal view {\n    if (_gauge == ZERO_GAUGE) revert IMetarouter.GaugeNotRegistered();\n    // slither-disable-next-line unused-return\n    (,,, bool _isRegistered,,,,,) = _leafVoter.gaugeStates(_gauge);\n    if (!_isRegistered) revert IMetarouter.GaugeNotRegistered();\n  }\n\n  /**\n   * @notice Returns whether a validated gauge is a concentrated-liquidity gauge, along with its factory.\n   * @dev Classifies through the factory permanently recorded for the gauge, after requiring the gauge's immutable\n   *      self-report to agree with that record. This gives venue classification and every downstream registry lookup\n   *      the same trust root. A CL factory reports `cl`; any other value takes the V2 path. A validated gauge always\n   *      carries a record, because `GaugeManager.createGauge` writes it in the same transaction that registers the\n   *      gauge with the Voter, so agreement is the only thing left to check.\n   * @param _gauge Validated gauge whose venue is resolved.\n   * @param _factoryRegistry Registry holding the gauge's permanent deploying-factory record.\n   * @return _isCl Whether the gauge stakes CL positions.\n   * @return _gaugeFactory Factory the gauge reports as its deployer.\n   */\n  function isClGauge(\n    address _gauge,\n    IFactoryRegistry _factoryRegistry\n  ) internal view returns (bool _isCl, IGaugeFactory _gaugeFactory) {\n    address _recordedFactory = _factoryRegistry.gaugeToFactory(_gauge);\n    address _reportedFactory = IGauge(_gauge).gaugeFactory();\n    if (_reportedFactory != _recordedFactory) {\n      revert IMetarouter.GaugeFactoryMismatch(_gauge, _recordedFactory, _reportedFactory);\n    }\n    _gaugeFactory = IGaugeFactory(_recordedFactory);\n    _isCl = keccak256(bytes(_gaugeFactory.GAUGE_TYPE())) == _CL_GAUGE_TYPE_HASH;\n  }\n\n  /**\n   * @notice Reverts when a V2 gauge's early-unstake penalty is live and the logical sender did not accept it.\n   * @dev Uses the gauge's penalty-window view, which shares the condition used when slashing emissions the account has\n   *      accrued on a V2 gauge. Routed messages carry no ordering guarantees, so a relayer could land a stale\n   *      deposit right before a withdrawal or claim and forfeit the account's full accrual; the explicit flag keeps\n   *      that outcome a decision of the logical sender. The gate checks only that the window is live, not whether\n   *      anything would actually be slashed: the gauge exposes no pre-penalty accrual view. So an exit with zero\n   *      accrued rewards inside the window also needs the flag, which is harmless to accept in that case.\n   * @param _gauge V2 gauge whose live penalty state is checked.\n   * @param _account Logical sender whose deposit timer controls the penalty.\n   * @param _allowPenalty Whether the logical sender explicitly accepts an active penalty.\n   */\n  function requirePenaltyAllowed(address _gauge, address _account, bool _allowPenalty) internal view {\n    if (_allowPenalty) return;\n\n    if (IV2Gauge(_gauge).isPenaltyActive({_account: _account})) revert IMetarouter.PenaltyNotAccepted();\n  }\n}\n"},"V3/src/interfaces/relay/IRelayFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IGovernor} from 'V3/interfaces/governor/IGovernor.sol';\nimport {IRelay} from 'V3/interfaces/relay/IRelay.sol';\nimport {IRelayVoteAdapter} from 'V3/interfaces/relay/IRelayVoteAdapter.sol';\nimport {IVoterPaymentsModule} from 'V3/interfaces/vpm/IVoterPaymentsModule.sol';\n\n/// @title  IRelayFactory\n/// @notice Creates Maxi and Protocol Relays as deterministic EIP-1167 minimal proxies over\n///         per-tier implementations. Each create call seeds a fresh sAERO with the initial\n///         deposit, transfers it to the clone's predicted address, then clones and initializes the\n///         Relay there — so initialization finds the sAERO already bound. Creation is restricted to\n///         RELAY_DEPLOYER_ROLE on the Voter; using a Relay is governed by the Relay's own tier.\ninterface IRelayFactory {\n  /// @notice Inputs to create a Relay. The protocol dependencies (VotingEscrow/VPM/Voter) are factory\n  ///         immutables, so they are not repeated here.\n  /// @param admin Initial owner: it holds the admin gates and manages every role bit.\n  /// @param keeper Initial KEEPER operator.\n  /// @param voter Initial VOTER_ROLE operator granted at deploy, or zero to skip; the owner can grant\n  ///        or rotate it later.\n  /// @param compounder Entrypoint granted COMPOUNDER at deploy, or zero to skip. Must be bound to\n  ///        the new Relay (see `predictRelay`).\n  /// @param converter Entrypoint granted CONVERTER at deploy, or zero to skip (same address as\n  ///        `compounder` for a Hybrid). Must be bound to the new Relay.\n  /// @param bootstrapOwner Recipient of the bootstrap shares minted 1:1 against the seed stake at\n  ///        initialization (genesis price/share is exactly 1, so the seed is not gifted to the first\n  ///        depositor). Must be non-zero; allow-listed at genesis on whitelist-gated tiers.\n  /// @param rewardToken First reward token to register at initialization, or zero to leave the registry\n  ///        empty for KEEPER. The registry never drops a token and the single-slot tiers close on the\n  ///        first one, so naming it here pins it in the same call that names the entrypoints.\n  /// @param entrypointVetoer Holder of ENTRYPOINT_VETOER on the Protocol tiers, or zero to run the\n  ///        entrypoint timelock without a veto. The public role paths refuse the bit, so an empty\n  ///        seat can never be filled afterwards; other tiers ignore this field.\n  /// @param rakeManagerAdmin Non-zero holder of RAKE_MANAGER_ADMIN.\n  /// @param protocolRakePips Genesis protocol rake, at most the tier's `MAX_RAKE_PIPS`.\n  /// @param allocatorRakePips Genesis allocator rake, at most the tier's `MAX_RAKE_PIPS`.\n  /// @param seedAmount Initial TOKEN staked into the Relay sAERO; pulled from the caller. A uint128,\n  ///        matching VotingEscrow's stake amount, so no narrowing happens at stake time. A seed below\n  ///        `MIN_STAKE_AMOUNT` is rejected downstream, where `initialize` re-checks the staked seed\n  ///        (the first-depositor inflation guard).\n  /// @param isPermanent Whether the seed stake is permanent (true) or time-locked.\n  /// @param ytTransferable True to deploy the yield token transferable; false makes it soulbound.\n  ///        Immutable switch on the YT clone; tiers with an allow list reject true.\n  /// @param stakingWeeks Lock length in weeks for a time-locked stake; must be zero when permanent.\n  /// @param salt Caller-chosen salt deriving the clone's deterministic address. Hashed together\n  ///        with the caller, so another account cannot occupy it; reusing a (caller, salt) pair on\n  ///        the same tier reverts.\n  /// @param config Relay configuration; its `tokenId` is overwritten with the freshly minted sAERO.\n  ///        Its `entrypointTimelock` delays every timelocked change on the Relay, rake raises included.\n  struct CreateParams {\n    address admin;\n    address keeper;\n    address voter;\n    address compounder;\n    address converter;\n    address bootstrapOwner;\n    address rewardToken;\n    address entrypointVetoer;\n    address rakeManagerAdmin;\n    uint256 protocolRakePips;\n    uint256 allocatorRakePips;\n    uint128 seedAmount;\n    bool isPermanent;\n    bool ytTransferable;\n    uint48 stakingWeeks;\n    bytes32 salt;\n    IRelay.RelayConfig config;\n  }\n\n  /// @notice The entrypoints a Relay was created with.\n  /// @param compounder Entrypoint granted COMPOUNDER at creation, or zero.\n  /// @param converter Entrypoint granted CONVERTER at creation, or zero.\n  struct InitialEntrypoints {\n    address compounder;\n    address converter;\n  }\n\n  /// @notice Emitted when a Relay is created.\n  /// @param relay The deployed Relay address.\n  /// @param tokenId The sAERO minted and bound to the Relay.\n  /// @param relayType The tier of the created Relay.\n  /// @param compounder Entrypoint granted COMPOUNDER at creation, or zero.\n  /// @param converter Entrypoint granted CONVERTER at creation, or zero.\n  event RelayCreated(\n    address indexed relay, uint256 indexed tokenId, IRelay.RelayType relayType, address compounder, address converter\n  );\n\n  /// @notice Emitted when the rake treasury changes.\n  /// @param treasury Address every Relay's protocol fees are collected to from here on.\n  event RakeTreasurySet(address indexed treasury);\n\n  /// @notice Emitted when the relay tape and its call gas limit are set.\n  /// @param tape The tape observations are relayed to, or zero to stop recording.\n  /// @param gasLimit Gas forwarded to each tape call.\n  event RelayTapeSet(address indexed tape, uint32 gasLimit);\n\n  /// @notice Thrown when a zero address is supplied for a protocol dependency.\n  error ZeroAddress();\n\n  /// @notice Thrown when the caller lacks the Voter role the call requires.\n  error NotAuthorized();\n\n  /// @notice Thrown when a tier implementation address holds no code, which would clone an inert\n  ///         Relay and strand the seed sAERO transferred to its predicted address.\n  error ImplementationNotAContract();\n\n  /// @notice Thrown when a created Relay comes out of `initialize` with no satellite tokens, the\n  ///         signature of a clone whose body never ran.\n  error RelayInitializationFailed();\n\n  /// @notice Thrown when a named entrypoint is bound to a different Relay.\n  error EntrypointNotBound();\n\n  /// @notice Thrown when the relay tape gas limit is set to zero.\n  error ZeroGasLimit();\n\n  /// @notice Thrown when the gas left cannot cover the configured tape call.\n  error InsufficientGasForCall();\n\n  /// @notice Creates a Maxi Relay: deposits into it are permissionless, creating it is not.\n  /// @param _params Creation inputs.\n  /// @return _relay The deployed Relay address.\n  /// @return _tokenId The sAERO bound to the Relay.\n  /// @dev Restricted to RELAY_DEPLOYER_ROLE: the gate says who may run a Maxi, not who may use one.\n  function createMaxiRelay(CreateParams calldata _params) external returns (address _relay, uint256 _tokenId);\n\n  /// @notice Creates a Protocol Relay, starting as L1 or directly as L2.\n  /// @param _params Creation inputs.\n  /// @param _startAsLevel2 True to deploy directly as Protocol L2; false to start as L1.\n  /// @return _relay The deployed Relay address.\n  /// @return _tokenId The sAERO bound to the Relay.\n  /// @dev Restricted to RELAY_DEPLOYER_ROLE, which is what makes `_startAsLevel2` safe to take from\n  ///      the caller.\n  function createProtocolRelay(\n    CreateParams calldata _params,\n    bool _startAsLevel2\n  ) external returns (address _relay, uint256 _tokenId);\n\n  /// @notice Sets the rake treasury. Restricted to GOVERNANCE_ROLE on the Voter.\n  /// @param _treasury Non-zero address every Relay's protocol fees are collected to.\n  function setRakeTreasury(address _treasury) external;\n\n  /// @notice Relays a reward distribution to the tape, fail-open towards the tape.\n  /// @dev Callable by anything, effectful only for relays this factory created: anything else\n  ///      returns silently, as does an unset tape. The tape call is capped at the configured gas and\n  ///      its revert is swallowed, so a broken tape can never block the distribution that reports it.\n  ///      Too little gas for that call is the one failure that does reach the reporter, so a starved\n  ///      transaction reverts rather than recording nothing in silence, which is what lets an\n  ///      estimator price a recording operation. That holds as long as the configured gas exceeds\n  ///      what a record costs by the 63/64 the call forwards: under a limit sized too tightly, a\n  ///      record that runs out is swallowed like any other tape failure. The values travel with the\n  ///      report because the reporter holds them exact at the moment of truth, sparing the tape every\n  ///      read back into the relay.\n  /// @param _token The reward token distributed.\n  /// @param _distributed The amount distributed to holders, post rake.\n  /// @param _index The relay's per-share index after the advance.\n  function recordRewardTape(address _token, uint256 _distributed, uint256 _index) external;\n\n  /// @notice Relays a compound to the tape, fail-open towards the tape.\n  /// @dev Same contract as `recordRewardTape`.\n  /// @param _net The amount staked into backing, post rake.\n  /// @param _backing The relay's backing after the compound lands.\n  /// @param _supply The principal supply that backing prices against.\n  function recordBackingTape(uint256 _net, uint256 _backing, uint256 _supply) external;\n\n  /// @notice Sets the relay tape and the gas forwarded to each tape call.\n  /// @dev Zero tape stops recording; the gas limit must stay nonzero so a set tape is never starved.\n  ///      With a tape set, the limit is a floor every compound and notify has to clear, so one set\n  ///      beyond what a transaction can carry halts those flows on every relay of this factory until\n  ///      governance lowers it again.\n  /// @param _relayTape The tape to relay observations to, or zero to stop recording.\n  /// @param _gasLimit Gas forwarded to each tape call.\n  function setRelayTape(address _relayTape, uint32 _gasLimit) external;\n\n  /// @notice The address a Relay will be created at.\n  /// @param _deployer Account that will call the create function.\n  /// @param _salt Salt it will pass in `CreateParams`.\n  /// @param _relayType Tier it will create; both Protocol types share one implementation.\n  /// @return _relay The predicted Relay address.\n  /// @dev Entrypoints of a Maxi or L1 Relay are deployed against this address before the Relay exists.\n  function predictRelay(\n    address _deployer,\n    bytes32 _salt,\n    IRelay.RelayType _relayType\n  ) external view returns (address _relay);\n\n  /// @notice Whether an address is a Relay this factory created.\n  /// @param _relay Address to check.\n  /// @return _created True when this factory created `_relay`.\n  /// @dev The membership check for consumers that gate a privileged path on being a Relay (the\n  ///      MetaRouter reads it). Answers in one storage read. Because creation is role-gated, a true\n  ///      answer means an authorized deployer created it.\n  function isRelay(address _relay) external view returns (bool _created);\n\n  /// @notice The entrypoints a Relay this factory created was initialized with.\n  /// @param _relay Relay to read.\n  /// @return _compounder Entrypoint granted COMPOUNDER at creation, or zero.\n  /// @return _converter Entrypoint granted CONVERTER at creation, or zero.\n  /// @dev A Maxi Relay can never change them, so for it this is the current pair. A Protocol Relay\n  ///      can change them once it is L2, so read its roles for the current ones.\n  function initialEntrypoints(address _relay) external view returns (address _compounder, address _converter);\n\n  /// @notice The number of Relays this factory has created.\n  /// @return _length The total count, which only ever grows.\n  function allRelaysLength() external view returns (uint256 _length);\n\n  /// @notice A page of created Relays, in creation order.\n  /// @param _start First index to read, inclusive.\n  /// @param _end Index to stop at, exclusive.\n  /// @return _relays The Relays in that range.\n  /// @dev Out-of-range input is clamped rather than rejected, so a caller can walk fixed-size pages\n  ///      off the end without checking the length first.\n  function allRelays(uint256 _start, uint256 _end) external view returns (address[] memory _relays);\n\n  /// @notice The VotingEscrow every Relay this factory creates binds to; also mints the seed sAERO.\n  /// @return _votingEscrow The VotingEscrow contract.\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /// @notice The underlying protocol TOKEN, read from VotingEscrow; pulled from callers to seed stakes.\n  /// @return _token The protocol TOKEN address.\n  function TOKEN() external view returns (address _token);\n\n  /// @notice The Voter whose role registry says who may create Relays here.\n  /// @return _voter The Voter address.\n  function VOTER() external view returns (address _voter);\n\n  /// @notice MaxiRelay implementation every Maxi clone delegates to.\n  /// @return _implementation The implementation address.\n  function MAXI_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice ProtocolRelay implementation every Protocol clone delegates to.\n  /// @return _implementation The implementation address.\n  function PROTOCOL_IMPLEMENTATION() external view returns (address _implementation);\n\n  /// @notice VoterPaymentsModule every created Relay starts on.\n  /// @return _vpm The VoterPaymentsModule contract.\n  function VPM() external view returns (IVoterPaymentsModule _vpm);\n\n  /// @notice Governor every created Relay starts casting into.\n  /// @return _governor The Governor contract.\n  function GOVERNOR() external view returns (IGovernor _governor);\n\n  /// @notice Adapter every created Relay's casts start encoded by.\n  /// @return _voteAdapter The vote adapter contract.\n  function VOTE_ADAPTER() external view returns (IRelayVoteAdapter _voteAdapter);\n\n  /// @notice Recipient of every Relay's protocol fees.\n  /// @return _treasury The rake treasury address.\n  function rakeTreasury() external view returns (address _treasury);\n\n  /// @notice The tape observations are relayed to, or zero when recording is off.\n  /// @return _tape The configured relay tape.\n  function relayTape() external view returns (address _tape);\n\n  /// @notice Gas forwarded to each tape call.\n  /// @return _gasLimit The configured per-call gas.\n  function relayTapeGasLimit() external view returns (uint32 _gasLimit);\n}\n"},"V3/src/metarouter/libraries/ClaimsLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {GaugeLib} from 'V3/metarouter/libraries/GaugeLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {V2PoolLib} from 'V3/metarouter/libraries/V2PoolLib.sol';\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {ICLGauge} from 'V3/interfaces/gauges/ICLGauge.sol';\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title ClaimsLib\n * @notice Reward-claim command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode while executing in the router's storage context. Tracking and logical-sender\n *      resolution go through `FundsLib`; the Voter is passed in because a library cannot read the router's immutables.\n */\nlibrary ClaimsLib {\n  /**\n   * @notice Claims the logical sender's gauge emissions.\n   * @dev The gauge enforces caller authorization; the account is fixed to the logical sender. An empty position-id\n   *      list selects the account-level overload, including for CL gauges, and can therefore iterate the account's\n   *      entire staked-position set. A non-empty list is accepted only for CL gauges and bounds their internal\n   *      iteration to the caller-supplied positions. A gauge claim delivers one emission token per chain (the\n   *      `ReceiptToken` on leaf, the canonical `TOKEN` on root), so when routed to the router that single token is\n   *      tracked for the closure sweep. The token is passed in because the router holds it as an immutable and no\n   *      reachable contract exposes it uniformly across chains. A V2 gauge slashes the account's full accrual while\n   *      the early-unstake penalty window is live, so the claim then requires the explicit `allowPenalty` consent;\n   *      a CL gauge slashes only newly accrued rewards and skips the check.\n   *\n   *      On root, `RootEmissionsHandler` saves rewards below the redeem minimum for each recipient. If the recipient\n   *      is the router, small rewards from different users accumulate together. The user whose batch reaches the\n   *      minimum receives the total, including less than 1e-12 TOKEN from earlier users. Claim directly to the user's\n   *      address to keep these rewards separate.\n   * @param _input ABI-encoded gauge, recipient, optional CL position ids, and whether an active V2 penalty is allowed;\n   *        an empty position list claims account-wide.\n   * @param _leafVoter Leaf Voter used to validate the gauge target.\n   * @param _emissionToken Token the gauge claim delivers on this chain, tracked when the router is the recipient.\n   * @param _factoryRegistry Registry holding the gauge's permanent deploying-factory record.\n   */\n  function claimGaugeRewards(\n    bytes calldata _input,\n    ILeafVoter _leafVoter,\n    IERC20 _emissionToken,\n    IFactoryRegistry _factoryRegistry\n  ) external {\n    (address _gauge, address _recipient, uint256[] memory _tokenIds, bool _allowPenalty) =\n      abi.decode(_input, (address, address, uint256[], bool));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    GaugeLib.requireRegisteredGauge(_gauge, _leafVoter);\n\n    if (_recipient == address(this)) MetarouterState.trackERC20(address(_emissionToken));\n\n    address _account = MetarouterState.msgSender();\n    // slither-disable-next-line unused-return\n    (bool _isCl,) = GaugeLib.isClGauge(_gauge, _factoryRegistry);\n    if (_isCl) {\n      if (_tokenIds.length == 0) IGauge(_gauge).claimEmissions(_account, _recipient);\n      else ICLGauge(_gauge).claimEmissions(_account, _recipient, _tokenIds);\n    } else {\n      if (_tokenIds.length > 0) revert IMetarouter.InvalidGaugeType();\n      GaugeLib.requirePenaltyAllowed(_gauge, _account, _allowPenalty);\n      IGauge(_gauge).claimEmissions(_account, _recipient);\n    }\n  }\n\n  /**\n   * @notice Claims V2 pool fees for the caller or the router.\n   * @dev Validates the pool through its permanent creation record, factory membership, and V2 pool family,\n   *      so existing pools remain usable after their factory is unapproved. User claims need approval from the caller.\n   *      `claimRouterFees` selects fees earned while the router held LP tokens. Anyone can claim these, as with\n   *      `SWEEP`. Tokens sent to the router are tracked for later commands and swept at batch end.\n   * @param _input ABI-encoded `(pool, recipient, claimRouterFees)`.\n   * @param _factoryRegistry Registry used to validate the pool.\n   */\n  function claimV2PoolFees(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _pool, address _recipient, bool _claimRouterFees) = abi.decode(_input, (address, address, bool));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // slither-disable-next-line unused-return\n    V2PoolLib.validatePool(_pool, _factoryRegistry);\n\n    if (_recipient == address(this)) {\n      MetarouterState.trackERC20(IPool(_pool).token0());\n      MetarouterState.trackERC20(IPool(_pool).token1());\n    }\n\n    // The pool sees the router as the caller.\n    // slither-disable-start unused-return\n    if (_claimRouterFees) IPool(_pool).claimFees(_recipient);\n    else IPool(_pool).claimFees({_account: MetarouterState.msgSender(), _recipient: _recipient});\n    // slither-disable-end unused-return\n  }\n}\n"},"V3/src/metarouter/libraries/V2PoolLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IPoolFactory} from 'V3/interfaces/factories/IPoolFactory.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\n\n/**\n * @title V2PoolLib\n * @notice Authenticates existing V2 pools independently of current factory approval.\n */\nlibrary V2PoolLib {\n  /// @notice Pool family reported by stable V2 pools.\n  bytes32 private constant _V2_STABLE_POOL_TYPE = 'V2_STABLE';\n  /// @notice Pool family reported by volatile V2 pools.\n  bytes32 private constant _V2_VOLATILE_POOL_TYPE = 'V2_VOLATILE';\n\n  /**\n   * @notice Validates a recorded V2 pool and returns its deploying factory.\n   * @dev Factory retirement prevents creation, but does not invalidate existing pools. Match swap validation by\n   *      checking the permanent creation record, factory membership, and supported pool family.\n   * @param _pool Pool target to authenticate.\n   * @param _factoryRegistry Registry holding the permanent creation record.\n   * @return _factory Recorded deploying factory.\n   */\n  function validatePool(address _pool, IFactoryRegistry _factoryRegistry) internal view returns (address _factory) {\n    _factory = _factoryRegistry.targetToFactory(_pool);\n    if (_factory == address(0)) revert IMetarouter.PoolNotRegistered();\n    if (!IPoolFactory(_factory).isPool(_pool)) revert IMetarouter.InvalidPool(_pool);\n    bytes32 _poolType = IPool(_pool).POOL_TYPE();\n    if (_poolType != _V2_VOLATILE_POOL_TYPE && _poolType != _V2_STABLE_POOL_TYPE) {\n      revert IMetarouter.InvalidPool(_pool);\n    }\n  }\n}\n"},"V3/src/interfaces/factories/ICLFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title ICLFactory\n/// @notice Concentrated-liquidity factory functions used by the dynamic swap fee hook and the Metarouter's CL\n///         position commands.\ninterface ICLFactory {\n  /// @notice Returns the manager authorized to configure swap fees.\n  function swapFeeManager() external view returns (address);\n\n  /// @notice Returns whether an address is a pool created by the factory.\n  function isPool(address _pool) external view returns (bool);\n\n  /// @notice Returns the default fee for a tick spacing.\n  function tickSpacingToFee(int24 _tickSpacing) external view returns (uint24);\n\n  /// @notice Returns the discount registry.\n  function discountRegistry() external view returns (address);\n\n  /// @notice Returns the concentrated-liquidity pool tape.\n  function clPoolTape() external view returns (address);\n\n  /// @notice Returns the canonical position manager issuing positions for this factory's pools.\n  /// @dev Immutable and nonzero upstream, paired with the manager's own `factory` getter. Returned as an `address` to\n  ///      mirror the upstream ABI and keep this interface free of a position-manager import.\n  /// @return The nonfungible position manager paired with this factory.\n  function positionManager() external view returns (address);\n}\n"},"V3/src/interfaces/pools/tape/IPoolTape.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title IPoolTape\n/// @notice Records and exposes per-swap cumulative metrics for V2 pools.\ninterface IPoolTape {\n  /*////////////////////////////////////////////////////////////\n                            STRUCTS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Per-pool running cumulatives updated on every swap.\n  /// @param cumulativeFee0 Cumulative token0 fees.\n  /// @param cumulativeFee1 Cumulative token1 fees.\n  /// @param cumulativeVolume0 Cumulative token0 input volume.\n  /// @param cumulativeVolume1 Cumulative token1 input volume.\n  /// @param cumulativeMevVolume0 Cumulative token0 toxic volume.\n  /// @param cumulativeMevVolume1 Cumulative token1 toxic volume.\n  /// @param cumulativeMevFee0 Cumulative token0 MEV fees.\n  /// @param cumulativeMevFee1 Cumulative token1 MEV fees.\n  /// @param lastSwapTimestamp Timestamp of the most recent recorded swap.\n  /// @param swapCount Cumulative swap count.\n  struct Accumulator {\n    // Slot 1\n    uint128 cumulativeFee0;\n    uint128 cumulativeFee1;\n    // Slot 2\n    uint128 cumulativeVolume0;\n    uint128 cumulativeVolume1;\n    // Slot 3\n    uint128 cumulativeMevVolume0;\n    uint128 cumulativeMevVolume1;\n    // Slot 4\n    uint128 cumulativeMevFee0;\n    uint128 cumulativeMevFee1;\n    // Slot 5\n    uint48 lastSwapTimestamp;\n    uint48 swapCount;\n  }\n\n  /// @notice A committed snapshot of the accumulator at a cadence boundary.\n  /// @param cumulativeFee0 Cumulative token0 fees.\n  /// @param cumulativeFee1 Cumulative token1 fees.\n  /// @param cumulativeVolume0 Cumulative token0 input volume.\n  /// @param cumulativeVolume1 Cumulative token1 input volume.\n  /// @param cumulativeMevVolume0 Cumulative token0 toxic volume.\n  /// @param cumulativeMevVolume1 Cumulative token1 toxic volume.\n  /// @param cumulativeMevFee0 Cumulative token0 MEV fees.\n  /// @param cumulativeMevFee1 Cumulative token1 MEV fees.\n  /// @param blockTimestamp Timestamp the observation was committed.\n  /// @param swapCount Cumulative swap count at commit.\n  struct Observation {\n    // Slot 1\n    uint128 cumulativeFee0;\n    uint128 cumulativeFee1;\n    // Slot 2\n    uint128 cumulativeVolume0;\n    uint128 cumulativeVolume1;\n    // Slot 3\n    uint128 cumulativeMevVolume0;\n    uint128 cumulativeMevVolume1;\n    // Slot 4\n    uint128 cumulativeMevFee0;\n    uint128 cumulativeMevFee1;\n    // Slot 5\n    uint48 blockTimestamp;\n    uint48 swapCount;\n  }\n\n  /// @notice The per-pool circular buffer of observations and its metadata.\n  /// @param observations Fixed-size buffer of committed observations.\n  /// @param index Index of the most recently committed observation.\n  /// @param cardinality Number of populated slots in the buffer.\n  /// @param cardinalityNext Number of observation slots that can be populated.\n  struct ObservationBuffer {\n    Observation[65_535] observations;\n    uint16 index;\n    uint16 cardinality;\n    uint16 cardinalityNext;\n  }\n\n  /// @notice Per-swap deltas passed into `record`.\n  /// @param fee0 token0 fee for this swap.\n  /// @param fee1 token1 fee for this swap.\n  /// @param volume0 token0 volume for this swap.\n  /// @param volume1 token1 volume for this swap.\n  /// @param mevVolume0 token0 toxic volume for this swap.\n  /// @param mevVolume1 token1 toxic volume for this swap.\n  /// @param mevFee0 token0 MEV fee for this swap.\n  /// @param mevFee1 token1 MEV fee for this swap.\n  struct PoolTapeData {\n    uint128 fee0;\n    uint128 fee1;\n    uint128 volume0;\n    uint128 volume1;\n    uint128 mevVolume0;\n    uint128 mevVolume1;\n    uint128 mevFee0;\n    uint128 mevFee1;\n  }\n\n  /*////////////////////////////////////////////////////////////\n                    EXTERNAL WRITE FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Records a swap's metrics, accumulating and committing at the cadence boundary.\n  /// @param _pool The pool the swap occurred in.\n  /// @param _data The per-swap deltas.\n  function record(address _pool, PoolTapeData calldata _data) external;\n\n  /*////////////////////////////////////////////////////////////\n                    EXTERNAL VIEW FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n\n  /// @notice Returns the stored observation at an index.\n  /// @dev Callers can get the valid index range from `observationBuffers`. The index must be in\n  ///      `[0, cardinality)` to read written observations.\n  /// @param _pool The pool to read.\n  /// @param _index The buffer index to read.\n  /// @return _observation The stored observation.\n  function getObservation(address _pool, uint16 _index) external view returns (Observation memory _observation);\n\n  /// @notice Returns an interpolated observation for each requested past timestamp (`block.timestamp - secondsAgo`).\n  /// @dev A timestamp at or after the latest swap returns the current accumulator with the requested timestamp,\n  ///      because the cumulatives have not moved since the last swap. A timestamp at or before the oldest stored\n  ///      observation returns the oldest available observation with its own timestamp. An unregistered pool returns zeroed observations.\n  /// @dev A timestamp newer than the newest committed observation is derived from live state, so its value moves\n  ///      as swaps land and a single transaction can shift it. Timestamps at or before the newest committed\n  ///      observation are settled and read the same on every call.\n  /// @param _pool The pool to read.\n  /// @param _secondsAgo The past timestamps to read. A zero timestamp returns the current accumulator.\n  /// @return _observations One observation per timestamp, in the same order as `_secondsAgo`.\n  function observe(\n    address _pool,\n    uint48[] calldata _secondsAgo\n  ) external view returns (Observation[] memory _observations);\n\n  /// @notice The per-pool current accumulator values getter.\n  /// @param _pool The pool to read.\n  /// @return cumulativeFee0 Cumulative token0 fees.\n  /// @return cumulativeFee1 Cumulative token1 fees.\n  /// @return cumulativeVolume0 Cumulative token0 input volume.\n  /// @return cumulativeVolume1 Cumulative token1 input volume.\n  /// @return cumulativeMevVolume0 Cumulative token0 toxic volume.\n  /// @return cumulativeMevVolume1 Cumulative token1 toxic volume.\n  /// @return cumulativeMevFee0 Cumulative token0 MEV fees.\n  /// @return cumulativeMevFee1 Cumulative token1 MEV fees.\n  /// @return lastSwapTimestamp Timestamp of the most recent recorded swap.\n  /// @return swapCount Cumulative swap count.\n  function accumulators(address _pool)\n    external\n    view\n    returns (\n      uint128 cumulativeFee0,\n      uint128 cumulativeFee1,\n      uint128 cumulativeVolume0,\n      uint128 cumulativeVolume1,\n      uint128 cumulativeMevVolume0,\n      uint128 cumulativeMevVolume1,\n      uint128 cumulativeMevFee0,\n      uint128 cumulativeMevFee1,\n      uint48 lastSwapTimestamp,\n      uint48 swapCount\n    );\n}\n"},"V3/src/metarouter/libraries/StakingLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nimport {ClResolverLib} from 'V3/metarouter/libraries/ClResolverLib.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {GaugeLib} from 'V3/metarouter/libraries/GaugeLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {INonfungiblePositionManager} from 'V3/interfaces/external/INonfungiblePositionManager.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IGaugeFactory} from 'V3/interfaces/factories/IGaugeFactory.sol';\nimport {IGauge} from 'V3/interfaces/gauges/IGauge.sol';\nimport {IV2Gauge} from 'V3/interfaces/gauges/IV2Gauge.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title StakingLib\n * @notice Gauge staking command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode but runs in its storage context. Custody tracking, sender resolution, and funding\n *      go through `MetarouterState` / `FundsLib`; the Voter, emission token, and factory registry are passed in\n *      because a library cannot read the router's immutables.\n *\n *      A gauge is validated through the Voter (`gaugeStates.isRegistered`), then its venue (V2 LP vs CL position) is\n *      read from its own factory `GAUGE_TYPE()`. The CL branch resolves the position manager from the registry's own\n *      gauge, target, and factory records rather than from calldata or from the gauge itself, so a staking command\n *      cannot name a collection. The V2 branch resolves nothing, and so makes no CL factory or manager call.\n */\nlibrary StakingLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Stakes a V2 LP balance or a CL position into a validated gauge, crediting the logical sender.\n   * @dev V2: funds the LP token through `FundsLib.fund` (from the batch balance or the logical sender), approves the\n   *      gauge for that amount, then deposits, which pulls it all and leaves no allowance. CL: takes the position into\n   *      custody (already held, or pulled from the logical sender), approves the gauge for it, then deposits. Either\n   *      way the gauge credits `msgSender()` as the staker.\n   * @param _input For a V2 gauge, ABI-encoded `(gauge, abi.encode(BalanceSpend, payerIsUser))`; for a CL gauge,\n   *        ABI-encoded `(gauge, abi.encode(tokenId))`, where a zero `tokenId` stakes the in-flight position.\n   * @param _leafVoter Leaf Voter used to validate the gauge target.\n   * @param _factoryRegistry Registry the CL path resolves the gauge's position manager through.\n   */\n  function stakeGauge(bytes calldata _input, ILeafVoter _leafVoter, IFactoryRegistry _factoryRegistry) external {\n    (address _gauge, bytes memory _payload) = abi.decode(_input, (address, bytes));\n    GaugeLib.requireRegisteredGauge(_gauge, _leafVoter);\n    address _owner = MetarouterState.msgSender();\n\n    (bool _isCl, IGaugeFactory _gaugeFactory) = GaugeLib.isClGauge(_gauge, _factoryRegistry);\n    if (_isCl) {\n      INonfungiblePositionManager _positionManager =\n        ClResolverLib.resolveGaugePositionManager(address(_gaugeFactory), _factoryRegistry);\n      uint256 _tokenId = MetarouterState.resolvePositionId(address(_positionManager), abi.decode(_payload, (uint256)));\n      _ensureNftCustody(_positionManager, _tokenId, _owner);\n      _positionManager.approve(_gauge, _tokenId);\n      IGauge(_gauge).depositFor(_tokenId, _owner);\n      // The position left the router for the gauge; clear the in-flight slots when it held this position.\n      MetarouterState.consumeInFlightNft(address(_positionManager), _tokenId);\n    } else {\n      (IMetarouter.BalanceSpend memory _spend, bool _payerIsUser) =\n        abi.decode(_payload, (IMetarouter.BalanceSpend, bool));\n      address _lpToken = IV2Gauge(_gauge).stakingToken();\n      uint256 _amount = FundsLib.fund(_lpToken, _spend, _payerIsUser);\n      // `depositFor` pulls exactly `_amount`, so success consumes the allowance in full and no reset is needed.\n      IERC20(_lpToken).forceApprove(_gauge, _amount);\n      IGauge(_gauge).depositFor(_amount, _owner);\n    }\n  }\n\n  /**\n   * @notice Withdraws the logical sender's V2 LP or CL stake from a validated gauge.\n   * @dev The router withdraws as an operator, so it needs the gauge's withdrawal approval for `msgSender()`. The V2 LP\n   *      or CL position returns to the router, and `withdrawFrom` also claims accrued emissions. Those reach the router\n   *      only when it holds claim approval, so the emission token is tracked only then. CL trading fees accrue to the\n   *      gauge while staked and are not delivered by withdrawal. A CL position returns through `safeTransferFrom`, so\n   *      `onERC721Received` tracks it; closure sweeps leftover ERC20s and requires the position to have left.\n   *      A V2 gauge slashes the account's full accrual while the early-unstake penalty window is live, so the\n   *      withdrawal then requires the explicit `allowPenalty` consent; a CL gauge slashes only what the position\n   *      accrued since its own deposit, so the flag is ignored there.\n   * @param _input For a V2 gauge, ABI-encoded `(gauge, abi.encode(amount), allowPenalty)`; for a CL gauge, ABI-encoded\n   *        `(gauge, abi.encode(tokenId), allowPenalty)`. The flag is ignored for CL gauges.\n   * @param _leafVoter Leaf Voter used to validate the gauge target.\n   * @param _emissionToken Emission token a gauge claim delivers on this chain, tracked when routed to the router.\n   * @param _factoryRegistry Registry the CL path resolves the gauge's position manager through.\n   */\n  function unstakeGauge(\n    bytes calldata _input,\n    ILeafVoter _leafVoter,\n    IERC20 _emissionToken,\n    IFactoryRegistry _factoryRegistry\n  ) external {\n    (address _gauge, bytes memory _payload, bool _allowPenalty) = abi.decode(_input, (address, bytes, bool));\n    GaugeLib.requireRegisteredGauge(_gauge, _leafVoter);\n    address _owner = MetarouterState.msgSender();\n    (bool _isCl, IGaugeFactory _gaugeFactory) = GaugeLib.isClGauge(_gauge, _factoryRegistry);\n    if (!_isCl) GaugeLib.requirePenaltyAllowed(_gauge, _owner, _allowPenalty);\n    bool _claimApproved = IGauge(_gauge).approvedForClaim(_owner, address(this));\n\n    if (_isCl) {\n      uint256 _tokenId = abi.decode(_payload, (uint256));\n      INonfungiblePositionManager _positionManager =\n        ClResolverLib.resolveGaugePositionManager(address(_gaugeFactory), _factoryRegistry);\n      // With claim approval, accrued emissions are sent to the router.\n      if (_claimApproved) MetarouterState.trackERC20(address(_emissionToken));\n      // The gauge returns the position through `safeTransferFrom`; set the collection, the gauge, and the position as\n      // expected so `onERC721Received` accepts and tracks exactly that delivery and nothing else can hand one in.\n      MetarouterState.setExpectedNft(address(_positionManager), _gauge, _tokenId);\n      IGauge(_gauge).withdrawFrom(_tokenId, _owner);\n      // The receiver consumes this authorization. If it remains set, the gauge returned without delivering the NFT\n      // through the authenticated callback and the entire withdrawal must revert.\n      // slither-disable-next-line unused-return\n      (, address _expectedSender,) = MetarouterState.expectedNft();\n      if (_expectedSender != address(0)) revert IMetarouter.NftNotReceived();\n    } else {\n      uint256 _amount = abi.decode(_payload, (uint256));\n      // The withdrawn V2 staking token always returns to the router.\n      MetarouterState.trackERC20(IV2Gauge(_gauge).stakingToken());\n      // With claim approval, the accrued emissions come to the router too.\n      if (_claimApproved) MetarouterState.trackERC20(address(_emissionToken));\n      IGauge(_gauge).withdrawFrom(_amount, _owner);\n    }\n  }\n\n  /**\n   * @notice Ensures the router holds the position, pulling it from the logical sender when it does not.\n   * @dev A position the router already owns must have entered during this batch — its tracking proves it — so a command\n   *      cannot operate an NFT stranded before the batch. Otherwise it is pulled from the logical sender, which\n   *      requires the router to hold the ERC721 approval.\n   * @param _positionManager Position manager holding the NFT.\n   * @param _tokenId Position to acquire.\n   * @param _owner Logical sender the position is pulled from when the router does not hold it.\n   */\n  function _ensureNftCustody(INonfungiblePositionManager _positionManager, uint256 _tokenId, address _owner) private {\n    if (_positionManager.ownerOf(_tokenId) == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_positionManager), _tokenId)) revert IMetarouter.NftNotInCustody();\n    } else {\n      // `transferFrom` does not call the receiver hook, so custody is recorded here instead. A failed pull reverts the\n      // batch and the write with it.\n      MetarouterState.trackNft(address(_positionManager), _tokenId);\n      // `_owner` is the logical caller (`msgSender`); the router only ever pulls the caller's own position.\n      // slither-disable-next-line arbitrary-send-erc20\n      _positionManager.transferFrom(_owner, address(this), _tokenId);\n    }\n  }\n}\n"},"V3/src/interfaces/external/ITokenRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title ITokenRouter\n * @notice Minimal view of a Hyperlane warp route (`TokenRouter`) used by the Metarouter's bridge command: the\n *         value-transfer and quote surface plus the managed-token accessor.\n * @dev Hyperlane bundles `ITokenFee`/`ITokenBridge` in one file and declares `token()` only on the abstract\n *      `TokenRouter` contract, so the selectors the command needs are mirrored here as one self-contained interface\n *      instead of importing the bundled file.\n */\ninterface ITokenRouter {\n  /**\n   * @notice A token amount to approve and/or send for a transfer, as reported by `quoteTransferRemote`.\n   * @param token Token to approve or send; the zero address denotes the native token.\n   * @param amount Amount of `token` the transfer requires.\n   */\n  struct Quote {\n    address token;\n    uint256 amount;\n  }\n\n  /**\n   * @notice Transfers `_amount` of the managed token to `_recipient` on `_destination`.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Recipient on the destination domain, as bytes32.\n   * @param _amount Amount to transfer.\n   * @return _messageId Hyperlane message id of the transfer.\n   */\n  function transferRemote(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount\n  ) external payable returns (bytes32 _messageId);\n\n  /**\n   * @notice Quotes the tokens to approve and/or send to transfer `_amount` to `_recipient` on `_destination`.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Recipient on the destination domain, as bytes32.\n   * @param _amount Amount to transfer.\n   * @return _quotes Tokens and amounts the transfer requires.\n   */\n  function quoteTransferRemote(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount\n  ) external view returns (Quote[] memory _quotes);\n\n  /**\n   * @notice Returns the token the warp route manages.\n   * @dev Per Hyperlane's `TokenRouter`: the collateral ERC20 for a collateral route, `address(this)` for a synthetic\n   *      route, or the zero address for a native route.\n   * @return _token The managed token address.\n   */\n  function token() external view returns (address _token);\n}\n"},"V3/src/metarouter/libraries/PaymentsLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\n\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {IWETH} from 'V3/interfaces/external/IWETH.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title PaymentsLib\n * @notice Payment command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode while executing in the router's storage context. Funding, tracking, and\n *      logical-sender resolution go through `FundsLib`; the wrapped native token is passed in because a library\n *      cannot read the router's immutables.\n */\nlibrary PaymentsLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Sends the execution address's full token balance available to the batch to a recipient.\n   * @dev The execution address is rejected as recipient: sweeping to self is a no-op, and unlike `transfer` this\n   *      command does not track the token, so the balance would linger untracked and never reach the caller at closure.\n   *      The available balance excludes the pre-batch native for the chain's native ERC20, whose `balanceOf`\n   *      is the execution address's native balance.\n   * @param _input ABI-encoded token, recipient, and minimum amount.\n   */\n  function sweep(bytes calldata _input) external {\n    (address _token, address _recipient, uint256 _minAmount) = abi.decode(_input, (address, address, uint256));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    if (_recipient == address(this)) revert IMetarouter.InvalidRecipient();\n    uint256 _balance = MetarouterState.availableErc20Balance(_token);\n    if (_balance < _minAmount) revert IMetarouter.InsufficientBalance(_token);\n    if (_balance > 0) IERC20(_token).safeTransfer(_recipient, _balance);\n  }\n\n  /**\n   * @notice Sends a selected portion of an execution-address token balance.\n   * @dev Resolves the portion against the router's own balance, then pushes it out via `FundsLib.push`. The token is\n   *      tracked so any residual left after a partial send is swept back to the sender at closure.\n   * @param _input ABI-encoded token, recipient, and balance spend mode.\n   */\n  function transfer(bytes calldata _input) external {\n    (address _token, address _recipient, IMetarouter.BalanceSpend memory _spend) =\n      abi.decode(_input, (address, address, IMetarouter.BalanceSpend));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    uint256 _amount = FundsLib.resolveSpend(_token, _spend);\n    MetarouterState.trackERC20(_token);\n    if (_amount > 0) FundsLib.push(_token, _recipient, _amount);\n  }\n\n  /**\n   * @notice Sends an NFT held in batch custody to a recipient.\n   * @dev Leaves the custody flag set so batch closure verifies the router no longer owns the NFT, and consumes any\n   *      matching in-flight reference.\n   * @param _input ABI-encoded `(address collection, uint256 tokenId, address recipient)`, where token id zero selects\n   *        the in-flight NFT of `collection`.\n   */\n  function transferNft(bytes calldata _input) external {\n    (address _collection, uint256 _tokenId, address _recipient) = abi.decode(_input, (address, uint256, address));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    // A self-transfer is a no-op.\n    if (_recipient == address(this)) revert IMetarouter.InvalidRecipient();\n\n    _tokenId = MetarouterState.resolvePositionId(_collection, _tokenId);\n    if (!MetarouterState.isNftInCustody(_collection, _tokenId)) revert IMetarouter.NftNotInCustody();\n\n    IERC721(_collection).safeTransferFrom(address(this), _recipient, _tokenId);\n    MetarouterState.consumeInFlightNft(_collection, _tokenId);\n  }\n\n  /**\n   * @notice Pulls a selected portion of the logical sender's token balance into the execution address's custody.\n   * @dev Resolves the portion against the sender's wallet balance (so `Pips` means a share of the wallet), then pulls\n   *      it in via `FundsLib.pull`. Unlike `FundsLib.fund`, which pulls an exact amount and returns the received delta\n   *      for a handler to consume, this command measures nothing: the amount surfaces through the closure sweep and\n   *      later live-balance reads.\n   * @param _input ABI-encoded token and balance spend mode.\n   */\n  function fundErc20(bytes calldata _input) external {\n    (address _token, IMetarouter.BalanceSpend memory _spend) = abi.decode(_input, (address, IMetarouter.BalanceSpend));\n    uint256 _amount = FundsLib.resolveBalance(_token, IERC20(_token).balanceOf(MetarouterState.msgSender()), _spend);\n    if (_amount > 0) FundsLib.pull(_token, _amount);\n  }\n\n  /**\n   * @notice Wraps native ETH available to the current batch.\n   * @param _input ABI-encoded balance spend mode.\n   * @param _weth Wrapped native token to deposit into.\n   */\n  function wrapEth(bytes calldata _input, IWETH _weth) external {\n    IMetarouter.BalanceSpend memory _spend = abi.decode(_input, (IMetarouter.BalanceSpend));\n    uint256 _amount = FundsLib.resolveBalance(address(0), MetarouterState.availableNativeBalance(), _spend);\n    if (_amount > 0) {\n      MetarouterState.trackERC20(address(_weth));\n      // Destination is the immutable WETH, not an arbitrary address; the deposit wraps the caller's own native.\n      // slither-disable-next-line arbitrary-send-eth\n      _weth.deposit{value: _amount}();\n    }\n  }\n\n  /**\n   * @notice Unwraps a selected portion of the WETH balance and sends native ETH to a recipient.\n   * @param _input ABI-encoded recipient and balance spend mode.\n   * @param _weth Wrapped native token to withdraw from.\n   */\n  function unwrapWeth(bytes calldata _input, IWETH _weth) external {\n    (address _recipient, IMetarouter.BalanceSpend memory _spend) =\n      abi.decode(_input, (address, IMetarouter.BalanceSpend));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    // No `trackERC20` here: WETH reaches custody only through producers that already track it, so a residual left\n    // by a partial unwrap is still swept at closure.\n    uint256 _amount = FundsLib.resolveSpend(address(_weth), _spend);\n    if (_amount > 0) {\n      _weth.withdraw(_amount);\n      if (_recipient != address(this)) {\n        // Sweeps the caller's own unwrapped balance to the caller-chosen recipient.\n        // slither-disable-next-line arbitrary-send-eth\n        (bool _success, bytes memory _data) = _recipient.call{value: _amount}('');\n        if (!_success) revert IMetarouter.NativeTransferFailed(_data);\n      }\n    }\n  }\n}\n"},"V3/src/interfaces/bridge/IMessageAdapter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IMessageAdapter\n * @notice Interface for transport adapters that carry payloads between `MessageOrchestrator` instances without\n * inspecting their content.\n */\ninterface IMessageAdapter {\n  /// @notice Thrown when `sendMessage` is invoked by a caller that is not a registered orchestrator.\n  error CallerNotOrchestrator();\n\n  /// @notice Thrown when the adapter is constructed with a zero chain id.\n  error InvalidChainId();\n\n  /// @notice Thrown when a required address argument is the zero address.\n  error ZeroAddress();\n\n  /**\n   * @notice Sends the payload through the transport.\n   * @dev Callable only by the registered orchestrator. Forwards `msg.value` to the underlying transport as the fee.\n   * Any excess over the actual fee is expected to be refunded by the transport directly to `_refundRecipient`.\n   * @param _message The wrapped message body forwarded to the underlying transport.\n   * @param _gasLimit Execution gas reserved for the destination handler.\n   * @param _refundRecipient Address that receives native ETH refunds from the transport.\n   */\n  function sendMessage(bytes calldata _message, uint256 _gasLimit, address _refundRecipient) external payable;\n\n  /**\n   * @notice Transport entrypoint invoked by the underlying transport to deliver an inbound payload to the local\n   * orchestrator.\n   * @dev Implementations that carry an underlying transport validate the transport caller, the origin, and the\n   * sender against their configured remote counterpart, then call the orchestrator with `REMOTE_CHAIN_ID` as the\n   * source chain id. Implementations without a transport (e.g., `RootLocalAdapter`) may revert.\n   * @dev Payable: the transport forwards the relayer's delivery value (Hyperlane's `Mailbox.process` attaches\n   * `msg.value` to `handle`), and the adapter passes it through to `route`, where it lands in the orchestrator's\n   * pre-funding pool.\n   * @param _origin Transport-level identifier of the source chain.\n   * @param _sender Trusted counterpart address as reported by the transport.\n   * @param _message The wrapped message body delivered to the orchestrator's `route`.\n   */\n  function handle(uint32 _origin, bytes32 _sender, bytes calldata _message) external payable;\n\n  /**\n   * @notice Quotes the transport fee `sendMessage` would charge for the same inputs.\n   * @dev Takes the identical arguments to `sendMessage` on purpose: the underlying transport prices the wrapped\n   * message and the destination gas budget together, so a quote taken with different arguments is not the fee\n   * the send will cost. Callers that quote-then-send in the same transaction get an exact figure; the\n   * fee-less local adapter quotes zero.\n   * @param _message The wrapped message body that would be forwarded to the underlying transport.\n   * @param _gasLimit Execution gas that would be reserved for the destination handler.\n   * @param _refundRecipient Address that would receive native ETH refunds from the transport.\n   * @return _fee Native amount `sendMessage` requires for these inputs.\n   */\n  function quoteMessage(\n    bytes calldata _message,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external view returns (uint256 _fee);\n\n  /**\n   * @notice Updates the stored remote adapter address.\n   * @dev Implementations that carry a remote counterpart gate this entrypoint behind the adapter authority and reject\n   * the zero value. Implementations without a remote counterpart (e.g., `RootLocalAdapter`) may revert.\n   * @param _remoteAdapter The new counterpart adapter on the remote chain.\n   */\n  function setRemoteAdapter(bytes32 _remoteAdapter) external;\n\n  /**\n   * @notice Chain id this adapter is bound to. Read by the orchestrator at registration time to verify the\n   * adapter is wired to the chain it is being registered for.\n   * @return _chainId Chain id of the counterpart chain (or the local chain id for the local adapter on root).\n   */\n  function REMOTE_CHAIN_ID() external view returns (uint256 _chainId);\n}\n"},"V3/src/interfaces/factories/IPoolFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IPoolTape} from 'V3/interfaces/pools/tape/IPoolTape.sol';\n\n/**\n * @title IPoolFactory\n * @notice Interface for the PoolFactory contract, the abstract base shared by the Aerodrome V2 volatile and stable pool factories\n */\ninterface IPoolFactory {\n  /// @notice Initial governance roles and modules of a pool factory.\n  /// @dev Every launch installs a pool tape, fee module and exact output fee quoter. Lite launches omit\n  ///      the discount registry and MEV tax module.\n  ///      Factory-bound fee modules and quoters must already be deployed with this factory's address.\n  /// @param poolAdmin Pool administrator.\n  /// @param pauser Factory pauser.\n  /// @param feeManager Manager of fees, fee modules and exact output quoting.\n  /// @param discountRegistryManager Manager of the discount registry.\n  /// @param poolTapeManager Manager of the pool tape.\n  /// @param factoryRegistry Registry that records pools created by this factory.\n  /// @param discountRegistry Initial discount registry, or zero for a lite launch.\n  /// @param poolTape Initial pool tape.\n  /// @param poolTapeGasLimit Nonzero gas forwarded to the pool tape.\n  /// @param feeModule Initial fee module.\n  /// @param feeModuleGasLimit Nonzero gas forwarded to the fee module.\n  /// @param mevTaxModule Initial MEV tax module, or zero for a lite launch.\n  /// @param mevTaxModuleGasLimit Gas forwarded to the MEV tax module; nonzero when it is configured.\n  /// @param exactOutFeeQuoter Initial exact output fee quoter.\n  struct PoolFactoryConfig {\n    address poolAdmin;\n    address pauser;\n    address feeManager;\n    address discountRegistryManager;\n    address poolTapeManager;\n    address factoryRegistry;\n    address discountRegistry;\n    address poolTape;\n    uint32 poolTapeGasLimit;\n    address feeModule;\n    uint32 feeModuleGasLimit;\n    address mevTaxModule;\n    uint32 mevTaxModuleGasLimit;\n    address exactOutFeeQuoter;\n  }\n\n  /*////////////////////////////////////////////////////////////\n                            EVENTS\n  ////////////////////////////////////////////////////////////*/\n  event SetFeeManager(address indexed feeManager);\n  event SetPauser(address indexed pauser);\n  event SetPauseState(bool indexed state);\n  event SetPoolAdmin(address indexed poolAdmin);\n  event PoolCreated(address indexed token0, address indexed token1, address pool, uint256);\n  event SetDefaultFee(uint256 defaultFee);\n  /// @notice Emitted when the fee module and the gas limit forwarded to it are set.\n  /// @param feeModule The new fee module address.\n  /// @param gasLimit The gas limit forwarded to the module on each read.\n  event SetFeeModule(address indexed feeModule, uint32 gasLimit);\n  event SetDiscountRegistryManager(address indexed discountRegistryManager);\n  event SetDiscountRegistry(address indexed discountRegistry);\n\n  /// @notice Emitted when the pool tape module and the gas limit forwarded to it are set.\n  /// @param poolTape The new pool tape address. The zero address disables the pool tape.\n  /// @param gasLimit The gas limit forwarded to the tape on each record.\n  event SetPoolTape(address indexed poolTape, uint32 gasLimit);\n\n  /// @notice Emitted when the pool tape manager is set.\n  /// @param poolTapeManager The new pool tape manager.\n  event SetPoolTapeManager(address indexed poolTapeManager);\n\n  /// @notice Emitted when the MEV tax module and the gas limit forwarded to it are set.\n  /// @param mevTaxModule The new MEV tax module address. The zero address disables the MEV tax.\n  /// @param gasLimit The gas limit forwarded to the module on each read.\n  event SetMevTaxModule(address indexed mevTaxModule, uint32 gasLimit);\n\n  /// @notice Emitted when the exact output fee quoter is set.\n  /// @param exactOutFeeQuoter The new quoter address.\n  event SetExactOutFeeQuoter(address indexed exactOutFeeQuoter);\n\n  /*////////////////////////////////////////////////////////////\n                            ERRORS\n  ////////////////////////////////////////////////////////////*/\n  error FeeTooHigh();\n  /// @notice Reverts when the gas left in the frame is equal to or below the gas limit set for the external call.\n  /// @dev EIP-150 forwards `min(_gasLimit, gasleft() - gasleft() / 64)`, so a transaction that sets its own gas\n  ///      limit too low would leave the callee short. Stopping here keeps the outcome of the call independent of\n  ///      the gas the caller supplied.\n  error InsufficientGasForCall();\n  /// @notice Thrown when the exact output fee quoter being set belongs to another factory.\n  error InvalidExactOutFeeQuoter();\n  error InvalidFeeModule();\n  /// @notice Thrown when an exact output quote is requested while no exact output fee quoter is set.\n  error NoExactOutFeeQuoter();\n  error NotDiscountRegistryManager();\n  error NotFeeManager();\n  error NotPauser();\n  error NotPoolAdmin();\n  /// @notice Thrown when the caller is not the pool tape manager.\n  error NotPoolTapeManager();\n  error PoolAlreadyExists();\n  error SameAddress();\n  error ZeroFee();\n  error ZeroAddress();\n  /// @notice Thrown when a gas limit is set to zero.\n  error ZeroGasLimit();\n\n  /*////////////////////////////////////////////////////////////\n                        EXTERNAL FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Set pool administrator\n  /// @dev Allowed to change the name and symbol of any pool created by this factory\n  /// @param _poolAdmin Address of the pool administrator\n  function setPoolAdmin(address _poolAdmin) external;\n\n  /// @notice Set the pauser for the factory contract\n  /// @dev The pauser can pause swaps on pools associated with the factory. Liquidity will always be withdrawable.\n  /// @dev Must be called by the pauser\n  /// @param _pauser Address of the pauser\n  function setPauser(address _pauser) external;\n\n  /// @notice Set discount registry manager\n  /// @dev The discount registry manager can update the `discountRegistry` variable\n  /// @param _discountRegistryManager Address of the discount registry manager\n  function setDiscountRegistryManager(address _discountRegistryManager) external;\n\n  /// @notice Set the discount registry for the factory contract\n  /// @param _discountRegistry Address of the discount registry\n  function setDiscountRegistry(address _discountRegistry) external;\n\n  /// @notice Pause or unpause swaps on pools associated with the factory\n  /// @param _state True to pause, false to unpause\n  function setPauseState(bool _state) external;\n\n  /// @notice Set the fee manager for the factory contract\n  /// @dev The fee manager can set fees on pools associated with the factory.\n  /// @dev Must be called by the fee manager\n  /// @param _feeManager Address of the fee manager\n  function setFeeManager(address _feeManager) external;\n\n  /// @notice Updates the feeModule of the factory and the gas limit forwarded to it\n  /// @dev Must be called by the current fee manager. Reverts if the gas limit set is zero.\n  /// @param _feeModule The new feeModule of the factory\n  /// @param _gasLimit The gas limit forwarded to the module on each read. Calculated as\n  ///        `(usage + buffer) * 64 / 63` where `usage` is the most gas the module can spend and `buffer` is what\n  ///        this factory spends checking the gas and dispatching the call. The `64 / 63` covers the share\n  ///        EIP-150 withholds from the callee.\n  function setFeeModule(address _feeModule, uint32 _gasLimit) external;\n\n  /// @notice Set the default fee for pools created by this factory.\n  /// @dev Throws if higher than maximum fee.\n  ///      Throws if fee is zero.\n  /// @param _defaultFee .\n  function setDefaultFee(uint256 _defaultFee) external;\n\n  /// @notice Create a pool for the given pair of tokens\n  /// @dev token order does not matter\n  /// @param tokenA .\n  /// @param tokenB .\n  function createPool(address tokenA, address tokenB) external returns (address pool);\n\n  /// @notice Sets the pool tape manager role that controls the pool tape configuration.\n  /// @dev Must be called by the current pool tape manager. The initial manager is set in the constructor.\n  /// @param _poolTapeManager Address of the new pool tape manager.\n  function setPoolTapeManager(address _poolTapeManager) external;\n\n  /// @notice Sets or clears the pool tape module that the pool records data into, and the gas limit sent to it.\n  /// @dev Must be called by the pool tape manager. The zero address disables the pool tape recording.\n  /// @dev Reverts if the gas limit set is zero.\n  /// @param _poolTape Address of the pool tape module.\n  /// @param _gasLimit The gas limit forwarded to the tape on each record. Calculated as\n  ///        `(usage + buffer) * 64 / 63` where `usage` is the most gas the tape can spend and `buffer` is what\n  ///        this factory spends checking the gas and dispatching the call. The `64 / 63` covers the share\n  ///        EIP-150 withholds from the callee.\n  function setPoolTape(address _poolTape, uint32 _gasLimit) external;\n\n  /// @notice Sets or clears the MEV tax module queried for the MEV tax on swaps, and the gas limit sent to it.\n  /// @dev Must be called by the fee manager. The zero address disables the MEV tax.\n  /// @dev Reverts if the gas limit set is zero.\n  /// @param _mevTaxModule Address of the MEV tax module.\n  /// @param _gasLimit The gas limit forwarded to the module on each read. Calculated as\n  ///        `(usage + buffer) * 64 / 63` where `usage` is the most gas the module can spend and `buffer` is what\n  ///        this factory spends checking the gas and dispatching the call. The `64 / 63` covers the share\n  ///        EIP-150 withholds from the callee.\n  function setMevTaxModule(address _mevTaxModule, uint32 _gasLimit) external;\n\n  /// @notice Sets the quoter that resolves the fee of exact output quotes.\n  /// @dev Must be called by the fee manager. Reverts on the zero address and when the quoter belongs to another\n  ///      factory. Exact output quotes revert until a quoter is set.\n  /// @param _exactOutFeeQuoter Address of the exact output fee quoter.\n  function setExactOutFeeQuoter(address _exactOutFeeQuoter) external;\n\n  /// @notice Forwards a pool's per-swap deltas to the pool tape, if one is set.\n  /// @param _data The per-swap deltas to record.\n  function recordPoolTape(IPoolTape.PoolTapeData calldata _data) external;\n\n  /*////////////////////////////////////////////////////////////\n                      PURE AND VIEW FUNCTIONS\n  ////////////////////////////////////////////////////////////*/\n  /// @notice Return a single pool created by this factory\n  /// @return Address of pool\n  function allPools(uint256 index) external view returns (address);\n\n  /// @notice Returns all pools created by this factory\n  /// @return Array of pool addresses\n  function allPools() external view returns (address[] memory);\n\n  /// @notice Returns the number of pools created from this factory\n  function allPoolsLength() external view returns (uint256);\n\n  /// @notice Is a valid pool created by this factory.\n  /// @param pool .\n  function isPool(address pool) external view returns (bool);\n\n  /// @notice Return address of pool created by this factory\n  /// @param tokenA .\n  /// @param tokenB .\n  function getPool(address tokenA, address tokenB) external view returns (address);\n\n  /// @notice Returns the base fee for a pool swap, accounting for custom fees set via the fee module.\n  /// @dev A fee module value above `MAX_BASE_FEE` is ignored, falling back to `defaultFee`.\n  /// @param _pool The pool to get the base fee for.\n  /// @param _caller The swap initiator.\n  /// @param _amount0In The token0 input amount of the swap, zero when token0 is not an input.\n  /// @param _amount1In The token1 input amount of the swap, zero when token1 is not an input.\n  /// @param _reserve0 The pre-swap token0 reserve of the pool.\n  /// @param _reserve1 The pre-swap token1 reserve of the pool.\n  /// @return The base fee in basis points.\n  function getBaseFee(\n    address _pool,\n    address _caller,\n    uint256 _amount0In,\n    uint256 _amount1In,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256);\n\n  /// @notice Returns the swap fee data for a pool swap, including the MEV tax.\n  /// @dev The MEV tax is clamped so the total stays at or below `MAX_FEE`.\n  /// @param _pool The pool to get the fee for.\n  /// @param _sender The swap caller, the pool's msg.sender.\n  /// @param _amount0In The token0 input amount of the swap, zero when token0 is not an input.\n  /// @param _amount1In The token1 input amount of the swap, zero when token1 is not an input.\n  /// @param _reserve0 The pre-swap token0 reserve of the pool.\n  /// @param _reserve1 The pre-swap token1 reserve of the pool.\n  /// @return _fee The combined swap fee in basis points.\n  /// @return _mevFee The MEV share of the fee in basis points, rounded up.\n  /// @return _toxic True when the swap is classified as toxic flow.\n  function getFee(\n    address _pool,\n    address _sender,\n    uint256 _amount0In,\n    uint256 _amount1In,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256 _fee, uint256 _mevFee, bool _toxic);\n\n  /// @notice Returns the total fee to gross up an exact output quote with, given the input the curve requires.\n  /// @dev Reverts with `NoExactOutFeeQuoter` while no quoter is set and with `FeeTooHigh` when the quoter\n  ///      answers above `MAX_FEE`.\n  /// @param _pool The pool to get the fee for.\n  /// @param _caller The swap initiator.\n  /// @param _amount0InAfterFee The token0 input the curve requires after the fee, zero when token0 is not an input.\n  /// @param _amount1InAfterFee The token1 input the curve requires after the fee, zero when token1 is not an input.\n  /// @param _reserve0 The pre-swap token0 reserve of the pool.\n  /// @param _reserve1 The pre-swap token1 reserve of the pool.\n  /// @return _fee The total fee in basis points.\n  function getFeeForAmountIn(\n    address _pool,\n    address _caller,\n    uint256 _amount0InAfterFee,\n    uint256 _amount1InAfterFee,\n    uint256 _reserve0,\n    uint256 _reserve1\n  ) external view returns (uint256 _fee);\n\n  /// @notice The pool implementation used to create pools\n  /// @return Address of pool implementation\n  function implementation() external view returns (address);\n\n  /// @notice The factory registry every created pool is recorded in as a target.\n  /// @dev Set at construction. createPool reverts until this factory is an approved\n  ///      target factory in the registry.\n  /// @return Address of the factory registry.\n  function factoryRegistry() external view returns (address);\n\n  /// @notice Whether the pools associated with the factory are paused or not.\n  /// @dev Pause only pauses swaps, liquidity will always be withdrawable.\n  function isPaused() external view returns (bool);\n\n  /// @notice The address of the pauser, can pause swaps on pools associated with factory.\n  /// @return Address of the pauser\n  function pauser() external view returns (address);\n\n  /// @notice The default fee for pools created by this factory.\n  /// @return Default fee\n  function defaultFee() external view returns (uint256);\n\n  /// @notice Hard-coded default fee value the factory variant is initialized with\n  /// @dev Constant per variant. The mutable current value lives in `defaultFee()`.\n  function DEFAULT_FEE() external view returns (uint256);\n\n  /// @notice Maximum default fee the fee manager can set\n  /// @return 3% in bips\n  function MAX_DEFAULT_FEE() external view returns (uint256);\n\n  /// @notice Maximum base fee the factory accepts from the fee module\n  /// @return 10% in bips\n  function MAX_BASE_FEE() external view returns (uint256);\n\n  /// @notice Maximum total fee a swap can be charged, base fee plus MEV tax\n  /// @return 20% in bips\n  function MAX_FEE() external view returns (uint256);\n\n  /// @notice Address of the fee manager, can set fees on pools associated with factory.\n  /// @notice This overrides the default fee for that pool.\n  /// @return Address of the fee manager\n  function feeManager() external view returns (address);\n\n  /// @notice Address of the fee module of the factory\n  /// @dev Can be changed by the current fee manager via setFeeModule\n  /// @return Address of the fee module\n  function feeModule() external view returns (address);\n\n  /// @notice The gas limit forwarded to the fee module on each read.\n  /// @return _gasLimit The gas limit.\n  function feeModuleGasLimit() external view returns (uint32 _gasLimit);\n\n  /// @notice Address of the pool administrator, can change the name and symbol of pools created by factory.\n  /// @return Address of the pool administrator\n  function poolAdmin() external view returns (address);\n\n  /// @notice Address of the discount registry manager, can update the `discountRegistry` variable\n  /// @return Address of the discount registry manager\n  function discountRegistryManager() external view returns (address);\n\n  /// @notice Address of the discount registry, that allows querying swap fee discounts\n  /// @return Address of the discount registry\n  function discountRegistry() external view returns (address);\n\n  /// @notice The pool tape module that pools record into. The zero address means recording is disabled.\n  /// @return Address of the pool tape module.\n  function poolTape() external view returns (address);\n\n  /// @notice The gas limit forwarded to the pool tape on each record.\n  /// @return _gasLimit The gas limit.\n  function poolTapeGasLimit() external view returns (uint32 _gasLimit);\n\n  /// @notice The pool tape manager, which controls the pool tape configuration.\n  /// @return Address of the pool tape manager.\n  function poolTapeManager() external view returns (address);\n\n  /// @notice The MEV tax module queried to get the mev tax for a swap. The zero address means the MEV tax is disabled.\n  /// @return Address of the MEV tax module.\n  function mevTaxModule() external view returns (address);\n\n  /// @notice The gas limit forwarded to the MEV tax module on each read.\n  /// @return _gasLimit The gas limit.\n  function mevTaxModuleGasLimit() external view returns (uint32 _gasLimit);\n\n  /// @notice The quoter that resolves the fee of exact output quotes. Exact output quotes revert while unset.\n  /// @return Address of the exact output fee quoter.\n  function exactOutFeeQuoter() external view returns (address);\n}\n"},"V3/src/interfaces/metarouter/IMetarouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IInterchainAccountRouter} from 'V3/interfaces/external/IInterchainAccountRouter.sol';\nimport {IWETH} from 'V3/interfaces/external/IWETH.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IRelayFactoryRegistry} from 'V3/interfaces/relay/IRelayFactoryRegistry.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title IMetarouter\n * @notice External surface, errors and events for the Metarouter and its command groups.\n */\ninterface IMetarouter {\n  // ============================== Types ==============================\n\n  /**\n   * @notice How a command spends an asset balance available to the execution address.\n   * @param Amount Spend an exact asset amount.\n   * @param Pips Spend a fraction of the current balance expressed in millionths.\n   */\n  enum SpendMode {\n    Amount,\n    Pips\n  }\n\n  /**\n   * @notice Selects how much of an execution-address asset balance a command spends.\n   * @param mode Balance-resolution mode.\n   * @param value Exact asset amount for `Amount`, or pip value for `Pips`.\n   */\n  struct BalanceSpend {\n    SpendMode mode;\n    uint256 value;\n  }\n\n  /**\n   * @notice Inputs for an exact-input V2 or CL swap command.\n   * @param pools Forward-ordered pools in the swap route.\n   * @param tokenIn Input token for the first pool.\n   * @param amountIn Input balance specification.\n   * @param payerIsUser Whether the execution owner funds the route input.\n   * @param minAmountOut Minimum output the recipient must receive. On V2 routes the bound is enforced against both\n   *        the router's own quote of the final hop and the recipient's balance delta; on CL routes it is enforced\n   *        against the pool-reported output.\n   * @param recipient Address that receives the final output.\n   */\n  struct SwapExactInParams {\n    address[] pools;\n    address tokenIn;\n    BalanceSpend amountIn;\n    bool payerIsUser;\n    uint256 minAmountOut;\n    address recipient;\n  }\n\n  /**\n   * @notice Inputs for an exact-output V2 or CL swap command.\n   * @param pools Forward-ordered pools in the swap route.\n   * @param tokenIn Input token for the first pool.\n   * @param amountOut Exact output the recipient must receive.\n   * @param payerIsUser Whether the execution owner funds the route input.\n   * @param maxAmountIn Maximum input the payer may spend.\n   * @param recipient Address that receives the final output.\n   */\n  struct SwapExactOutParams {\n    address[] pools;\n    address tokenIn;\n    uint256 amountOut;\n    bool payerIsUser;\n    uint256 maxAmountIn;\n    address recipient;\n  }\n\n  /**\n   * @notice Settlement authorization forwarded to the active CL swap callback.\n   * @dev With no remaining pools the payer settles the invoice directly; otherwise the callback swaps the previous\n   *      route pool for the exact invoiced amount, recursing hop by hop until the first pool is paid.\n   * @param pools Route pools, of which only the first `remaining` are still unexecuted.\n   * @param zeroForOne Whether token0 is exchanged for token1 for each route pool.\n   * @param remaining Number of unexecuted route pools left before the payer settles directly.\n   * @param tokenIn Token the payer owes.\n   * @param payer Address authorized to pay.\n   * @param maxAmountIn Maximum token input the payer may transfer.\n   */\n  struct ClSwapCallbackData {\n    address[] pools;\n    bool[] zeroForOne;\n    uint256 remaining;\n    address tokenIn;\n    address payer;\n    uint256 maxAmountIn;\n  }\n\n  /**\n   * @notice Selects the destination Hyperlane interchain account configuration used by a cross-chain command.\n   * @dev An empty configuration (`router == address(0)` and `ism == address(0)`) resolves both values from the\n   *      interchain account router's enrolled defaults. A non-zero `router` selects a custom preserved\n   *      configuration, where a zero `ism` intentionally delegates verification to Hyperlane's default ISM while\n   *      remaining zero in the account derivation.\n   * @param router Custom destination interchain account router, or zero to use the enrolled configuration.\n   * @param ism Custom destination interchain security module; may be zero when `router` is non-zero.\n   */\n  struct IcaConfig {\n    address router;\n    address ism;\n  }\n\n  /**\n   * @notice Inputs for the `BRIDGE_TOKEN` command.\n   * @param token Token being bridged, or zero for native.\n   * @param bridge Caller-selected Warp Route.\n   * @param spend Balance selection funding the bridge.\n   * @param messageFee Native message fee for an ERC20 bridge; zero when the route charges interchain gas in its own\n   *        token, since that gas paymaster rejects native value.\n   * @param maxFee Maximum accepted token-denominated bridge fee: an absolute token amount for `Amount`, or a fraction\n   *        of the resolved bridge amount in millionths, rounded up, for `Pips`.\n   * @param domain Destination Hyperlane domain.\n   * @param recipient Destination recipient, the zero address derives the logical sender's interchain account.\n   * @param icaConfig Optional custom destination ICA router and ISM.\n   * @param targetRouter Destination token router for an explicit cross-collateral route, or zero for the source\n   *        router's enrolled route to `domain`.\n   */\n  struct BridgeTokenParams {\n    address token;\n    address bridge;\n    BalanceSpend spend;\n    uint256 messageFee;\n    BalanceSpend maxFee;\n    uint32 domain;\n    address recipient;\n    IcaConfig icaConfig;\n    bytes32 targetRouter;\n  }\n\n  /**\n   * @notice Inputs for the `EXECUTE_CROSS_CHAIN` command.\n   * @param domain Destination Hyperlane domain.\n   * @param commitment Commitment to the destination calls.\n   * @param messageFee Native message fee forwarded to Hyperlane.\n   * @param tokenFee Maximum fee-token approval granted to Hyperlane.\n   * @param hook Post-dispatch hook.\n   * @param hookMetadata Metadata forwarded to the post-dispatch hook.\n   * @param icaConfig Optional custom destination ICA router and ISM.\n   */\n  struct ExecuteCrosschainParams {\n    uint32 domain;\n    bytes32 commitment;\n    uint256 messageFee;\n    uint256 tokenFee;\n    address hook;\n    bytes hookMetadata;\n    IcaConfig icaConfig;\n  }\n\n  /**\n   * @notice Inputs for the `REDEEM` command.\n   * @param spend Balance selection funding the redeem from the held `ReceiptToken`.\n   * @param payerIsUser Whether to pull an exact `ReceiptToken` amount from the logical sender instead of the execution\n   *        balance.\n   * @param recipient Address that receives the minted `TOKEN` on root. The leaf cannot inspect that address on root or\n   *        determine whether it safely accounts for deposits. In particular, `TOKEN` sent to a permissionless\n   *        Metarouter can be swept by any caller, with no privileged recovery right for the redeemer.\n   * @param gasLimit Execution gas reserved for the destination handler; the transport rejects zero.\n   * @param refundRecipient Address the transport refunds the unspent `messageFee` to, or zero to name the Metarouter,\n   *        which returns the excess with the batch's other unused funds. Name an address instead when the batch caller\n   *        cannot receive native, since the closing refund reverts the batch in that case.\n   * @param messageFee Native message fee forwarded to the dispatch.\n   */\n  struct RedeemParams {\n    BalanceSpend spend;\n    bool payerIsUser;\n    address recipient;\n    uint256 gasLimit;\n    address refundRecipient;\n    uint256 messageFee;\n  }\n\n  /**\n   * @notice Arguments of a `MINT_CL_POSITION` command; the two pool tokens are funded independently before the mint.\n   * @dev `token0`/`token1` must be sorted ascending, the ordering the position manager expects.\n   * @param factory Protocol CL factory whose canonical position manager mints the position. Current approval is\n   *        required only when creating a pool.\n   * @param token0 First pool token, sorted ascending.\n   * @param token1 Second pool token, sorted ascending.\n   * @param tickSpacing Tick spacing identifying the pool alongside its tokens.\n   * @param tickLower Lower tick of the position range.\n   * @param tickUpper Upper tick of the position range.\n   * @param spend0 Selection applied when funding `token0`.\n   * @param spend1 Selection applied when funding `token1`.\n   * @param payerIsUser0 Whether to pull an exact `token0` amount from the logical sender instead of the execution\n   *        balance.\n   * @param payerIsUser1 Whether to pull an exact `token1` amount from the logical sender instead of the execution\n   *        balance.\n   * @param amount0Min Minimum `token0` contributed, as a slippage bound.\n   * @param amount1Min Minimum `token1` contributed, as a slippage bound.\n   * @param recipient Address the minted position goes to; set it to the metarouter to keep the position in flight for a\n   *        later command.\n   * @param sqrtPriceX96 Nonzero requests pool creation at this price and requires current factory approval; zero uses\n   *        an existing pool.\n   * @param deadline Timestamp after which the mint reverts.\n   */\n  struct MintClParams {\n    address factory;\n    address token0;\n    address token1;\n    int24 tickSpacing;\n    int24 tickLower;\n    int24 tickUpper;\n    BalanceSpend spend0;\n    BalanceSpend spend1;\n    bool payerIsUser0;\n    bool payerIsUser1;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    address recipient;\n    uint160 sqrtPriceX96;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Arguments of an `INCREASE_CL_LIQUIDITY` command; the position's tokens are funded independently before the\n   *         increase.\n   * @dev The position's `token0`/`token1` are read from the position manager, so only the funding selection is passed.\n   * @param factory Protocol CL factory whose canonical position manager holds the position, including a retired factory.\n   * @param tokenId Position to add liquidity to, or zero to use the in-flight position.\n   * @param spend0 Selection applied when funding the position's `token0`.\n   * @param spend1 Selection applied when funding the position's `token1`.\n   * @param payerIsUser0 Whether to pull an exact `token0` amount from the logical sender instead of the execution\n   *        balance.\n   * @param payerIsUser1 Whether to pull an exact `token1` amount from the logical sender instead of the execution\n   *        balance.\n   * @param amount0Min Minimum `token0` contributed, as a slippage bound.\n   * @param amount1Min Minimum `token1` contributed, as a slippage bound.\n   * @param deadline Timestamp after which the increase reverts.\n   */\n  struct IncreaseClParams {\n    address factory;\n    uint256 tokenId;\n    BalanceSpend spend0;\n    BalanceSpend spend1;\n    bool payerIsUser0;\n    bool payerIsUser1;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Inputs for the ADD_LIQUIDITY command.\n   * @param factory Pool factory that resolves, or creates, the pair's stable or volatile pool. Current factory\n   *        approval is required only when creating a pool.\n   * @param tokenA First token supplied by the caller. All fields ending in `A` refer to this token, regardless of the\n   *        pool's canonical token order.\n   * @param tokenB Second token supplied by the caller. All fields ending in `B` refer to this token.\n   * @param createPool Whether a missing pool may be created; when false a pair with no pool reverts with\n   *        `PoolNotFound`.\n   * @param spendA Balance selection funding tokenA.\n   * @param spendB Balance selection funding tokenB.\n   * @param payerAIsUser Whether tokenA is pulled from the logical sender as an exact amount instead of the execution\n   *        balance.\n   * @param payerBIsUser Whether tokenB is pulled from the logical sender as an exact amount instead of the execution\n   *        balance.\n   * @param amountAMin Minimum tokenA the router commits to the pool after the optimal-amount trim. A fee-on-transfer\n   *        token is not rejected, but the minimum bounds what the router commits, not what the pool receives, so the\n   *        guarantee does not hold for it.\n   * @param amountBMin Minimum tokenB the router commits to the pool after the optimal-amount trim. A fee-on-transfer\n   *        token is not rejected, but the minimum bounds what the router commits, not what the pool receives, so the\n   *        guarantee does not hold for it.\n   * @param recipient Address the minted LP tokens are sent to.\n   * @param liquidityMin Minimum LP tokens the pool must mint for the deposit. The pool mints from its received\n   *        balances, so unlike the per-token minimums this bound holds even for a fee-on-transfer token. Zero disables\n   *        this router-level bound; the pool still rejects a zero-liquidity mint.\n   */\n  struct AddLiquidityParams {\n    address factory;\n    address tokenA;\n    address tokenB;\n    bool createPool;\n    BalanceSpend spendA;\n    BalanceSpend spendB;\n    bool payerAIsUser;\n    bool payerBIsUser;\n    uint256 amountAMin;\n    uint256 amountBMin;\n    address recipient;\n    uint256 liquidityMin;\n  }\n\n  /**\n   * @notice Inputs for the REMOVE_LIQUIDITY command.\n   * @param pool Registered V2 pool whose LP tokens are burned; the pool contract is its own LP token.\n   * @param lpSpend Balance selection funding the LP amount to burn.\n   * @param payerIsUser Whether the LP is pulled from the logical sender as an exact amount instead of the execution\n   *        balance.\n   * @param amount0Min Minimum token0 the burn reports returning. A fee-on-transfer token is not rejected, but the\n   *        minimum bounds what the burn reports, not what the recipient receives, so the guarantee does not hold\n   *        for it.\n   * @param amount1Min Minimum token1 the burn reports returning. A fee-on-transfer token is not rejected, but the\n   *        minimum bounds what the burn reports, not what the recipient receives, so the guarantee does not hold\n   *        for it.\n   * @param recipient Address the underlying token0/token1 are sent to.\n   */\n  struct RemoveLiquidityParams {\n    address pool;\n    BalanceSpend lpSpend;\n    bool payerIsUser;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    address recipient;\n  }\n\n  // ============================== Events ==============================\n\n  /**\n   * @notice Emitted when the outermost frame of a batch completes.\n   * @param _sender Logical sender that owned the completed batch.\n   */\n  event BatchExecuted(address indexed _sender);\n\n  // ============================== Errors ==============================\n\n  /// @notice Thrown when an inbound asset reaches the router outside a batch.\n  error BatchNotActive();\n\n  /**\n   * @notice Thrown when a command depends on a protocol contract this deployment was built without.\n   * @param _commandType Command ID that is disabled on this deployment.\n   */\n  error CommandDisabled(uint256 _commandType);\n\n  /// @notice Thrown when an external caller enters `execute()` while a batch is running.\n  error ContractLocked();\n\n  /// @notice Thrown when Metarouter is reached through delegatecall instead of a direct call.\n  error DirectCallRequired();\n\n  /// @notice Thrown when the batch deadline has passed.\n  error Expired();\n\n  /**\n   * @notice Thrown when a command byte decodes to an undefined command ID.\n   * @param _commandType Undefined command ID that was dispatched.\n   */\n  error InvalidCommandType(uint256 _commandType);\n\n  /// @notice Thrown when ETH arrives from an unexpected sender outside a batch.\n  error InvalidEthSender();\n\n  /// @notice Thrown when a batch spends native ETH held before that batch started.\n  error PreBatchNativeBalanceSpent();\n\n  /// @notice Thrown when the router's native balance differs from its pre-batch balance after the closing refund.\n  error NativeBalanceNotCleared();\n\n  /**\n   * @notice Thrown when a native ETH transfer fails, bubbling the callee's revert data.\n   * @param _data Revert data returned by the failed low-level call.\n   */\n  error NativeTransferFailed(bytes _data);\n\n  /**\n   * @notice Thrown when the execution-address balance cannot cover a spend or minimum floor.\n   * @param _asset ERC20 address, or address(0) for native ETH.\n   */\n  error InsufficientBalance(address _asset);\n\n  /// @notice Thrown when a liquidity command's resolved token0 amount falls below its minimum.\n  error InsufficientAmount0();\n\n  /// @notice Thrown when a liquidity command's resolved token1 amount falls below its minimum.\n  error InsufficientAmount1();\n\n  /// @notice Thrown when an add-liquidity command's resolved tokenA amount falls below its minimum.\n  error InsufficientAmountA();\n\n  /// @notice Thrown when an add-liquidity command's resolved tokenB amount falls below its minimum.\n  error InsufficientAmountB();\n\n  /**\n   * @notice Thrown when an add-liquidity command mints fewer LP tokens than requested.\n   * @param _minimum Minimum LP tokens requested by the caller.\n   * @param _minted LP tokens minted by the pool.\n   */\n  error InsufficientLiquidityMinted(uint256 _minimum, uint256 _minted);\n\n  /// @notice Thrown when the commands and inputs arrays differ in length.\n  error LengthMismatch();\n\n  /// @notice Thrown when an external pull uses a router-balance spend mode.\n  error InvalidSpendMode();\n\n  /**\n   * @notice Thrown when a pip spend exceeds 100%.\n   * @param _pips Pip value that exceeded the 100% denominator.\n   */\n  error InvalidPips(uint256 _pips);\n\n  /// @notice Thrown when a payment command names an invalid recipient.\n  error InvalidRecipient();\n\n  /// @notice Thrown when a claim or stake targets a gauge not registered with the Voter.\n  error GaugeNotRegistered();\n\n  /// @notice Thrown when a routed V2 gauge claim or withdrawal would incur a penalty without explicit user consent.\n  error PenaltyNotAccepted();\n\n  /// @notice Thrown when position ids are supplied for a gauge that does not support position-level claims.\n  error InvalidGaugeType();\n\n  /// @notice Thrown when an NFT arrives from a collection other than the one the active command solicited.\n  error InvalidNftSender();\n\n  /// @notice Thrown when a position arrives from a sender the active command did not solicit it from.\n  error UnexpectedNftSender();\n\n  /// @notice Thrown when a command would arm an expected NFT sender while another authorization is still pending.\n  error NftSenderNotCleared();\n\n  /// @notice Thrown when a gauge withdrawal returns without delivering the requested position through the receiver.\n  error NftNotReceived();\n\n  /// @notice Thrown when a command would operate a router-held NFT that did not enter custody during the active batch.\n  error NftNotInCustody();\n\n  /// @notice Thrown when a tracked NFT still belongs to the router at batch closure.\n  error NftNotCleared();\n\n  /**\n   * @notice Thrown when a producer command would leave a second NFT in flight before the first is consumed.\n   */\n  error InFlightNftPresent();\n\n  /// @notice Thrown when a command references the in-flight NFT but none of the expected collection is in flight.\n  error NoInFlightNft();\n\n  /// @notice Thrown when a CL position command targets a position the logical sender does not own.\n  error NotPositionOwner();\n\n  /// @notice Thrown when a V2 liquidity command or fee claim targets a pool without a FactoryRegistry creation record.\n  error PoolNotRegistered();\n\n  /// @notice Thrown when an operation requiring current target-factory approval selects an unapproved factory.\n  error FactoryNotApproved();\n\n  /**\n   * @notice Thrown when no record names a factory's position manager: the factory getter returns the zero address,\n   *         or it reverts and the registry pairs the factory with no gauge factory, or the paired gauge factory\n   *         binds the zero address.\n   * @param _factory Factory whose position manager is unset.\n   */\n  error PositionManagerNotConfigured(address _factory);\n\n  /**\n   * @notice Thrown when the position manager a factory names does not point back at that factory.\n   * @param _factory Factory that named the manager.\n   * @param _positionManager Position manager that failed the reverse-link check.\n   */\n  error PositionManagerFactoryMismatch(address _factory, address _positionManager);\n\n  /**\n   * @notice Thrown when a gauge reports a factory other than the one permanently recorded for it.\n   * @param _gauge Gauge whose factory identity is inconsistent.\n   * @param _recordedFactory Gauge factory recorded by the FactoryRegistry.\n   * @param _reportedFactory Gauge factory reported by the gauge itself.\n   */\n  error GaugeFactoryMismatch(address _gauge, address _recordedFactory, address _reportedFactory);\n\n  /**\n   * @notice Thrown when the factory resolves a pool that does not hold the requested token pair.\n   * @param _pool Resolved pool address.\n   */\n  error PoolTokenMismatch(address _pool);\n\n  /// @notice Thrown when the pair has no pool and the command may not create one.\n  error PoolNotFound();\n\n  /**\n   * @notice Thrown when a root-only command (sAERO creation or relay deposit) runs on a leaf deployment.\n   * @param _commandType Command ID that is root-only.\n   */\n  error NotRoot(uint256 _commandType);\n\n  /**\n   * @notice Thrown when a leaf-only command (redeem) runs on the root deployment.\n   * @param _commandType Command ID that is leaf-only.\n   */\n  error NotLeaf(uint256 _commandType);\n\n  /**\n   * @notice Thrown when a relay deposit targets an address whose reported factory the RelayFactoryRegistry does not\n   *         approve, or which that factory did not create.\n   */\n  error UnauthorizedRelay();\n\n  /**\n   * @notice Thrown when a relay reports a VoterPaymentsModule the staking escrow does not recognize (it lacks\n   *         `VPM_ROLE`), so the router refuses to grant it the operator approval a deposit needs.\n   */\n  error UnauthorizedRelayVpm();\n\n  /// @notice Thrown when a constructor dependency is the zero address.\n  error ZeroAddress();\n\n  /// @notice Thrown when the native ERC20 reports more decimals than the native asset's eighteen.\n  error InvalidNativeErc20Decimals();\n\n  /// @notice Thrown when the wrapped native token and the native ERC20 are the same address.\n  error WethIsNativeErc20();\n\n  /// @notice Thrown when a command resolves a zero asset amount to act on.\n  error ZeroAmount();\n\n  /// @notice Thrown when a cross-chain dispatch targets a domain with no interchain account router enrolled.\n  error UnregisteredDomain();\n\n  /// @notice Thrown when an interchain account configuration names an ISM without a custom destination router.\n  error InvalidInterchainAccountConfig();\n\n  /// @notice Thrown when a warp route's token fee exceeds the caller's accepted maximum.\n  error TokenFeeExceedsMax();\n\n  /**\n   * @notice Thrown when a warp route's token fee equals or exceeds the amount being bridged, leaving nothing to\n   *         deliver.\n   */\n  error TokenFeeExceedsAmount();\n\n  /**\n   * @notice Thrown when a caller-selected warp route quotes a total charge below the amount being bridged, which no\n   *         honest route reports because the charge covers the delivered amount itself.\n   */\n  error InvalidBridgeQuote();\n\n  /**\n   * @notice Thrown when a native warp route quotes the reduced bridge amount above the resolved budget.\n   * @param _quote Native total the route quotes for the reduced bridge amount.\n   * @param _budget Native budget resolved for the bridge.\n   */\n  error BridgeQuoteExceedsBudget(uint256 _quote, uint256 _budget);\n\n  /**\n   * @notice Thrown when the caller-selected warp route does not manage the token being bridged: the route's `token()`\n   *         does not equal the command's token, so it would pull or burn a different asset than the router approved.\n   *         Guards an honest token/route mismatch; an untrusted route can still misreport, so this is not route trust.\n   */\n  error BridgeTokenMismatch();\n\n  /// @notice Thrown when explicit cross-collateral routing is requested with the zero-address native-token marker.\n  error UnsupportedCrossCollateralToken();\n\n  /// @notice Thrown when explicit cross-collateral routing targets the origin domain's synchronous transfer path.\n  error SameDomainCrossCollateralTransfer();\n\n  /**\n   * @notice Thrown when a bridge quote includes a nonzero fee in a token other than the source token or native\n   *         currency.\n   * @param _token Address of the unsupported fee token.\n   */\n  error UnsupportedBridgeFeeToken(address _token);\n\n  /// @notice Thrown when a cross-chain dispatch's hook metadata carries no refund address.\n  error InvalidHookMetadata();\n\n  /// @notice Thrown when an amount cannot be represented as a signed CL swap amount.\n  error AmountOverflow();\n\n  /**\n   * @notice Thrown when a CL pool returns without consuming its callback authorization.\n   * @param _pool Pool still stored as the expected callback caller.\n   */\n  error CallbackNotCleared(address _pool);\n\n  /// @notice Thrown when an exact-output swap delivers a different output than the requested amount.\n  error InvalidAmountOut();\n\n  /// @notice Thrown when a callback does not contain exactly one positive token delta.\n  error InvalidCallbackDeltas();\n\n  /**\n   * @notice Thrown when a caller is not the currently authorized CL pool.\n   * @param _caller Unauthorized callback caller.\n   */\n  error InvalidCallbackCaller(address _caller);\n\n  /// @notice Thrown when a pool path is empty or its adjacent tokens do not connect.\n  error InvalidPath();\n\n  /// @notice Thrown when a payer is neither the execution address nor the logical sender.\n  error InvalidPayer();\n\n  /**\n   * @notice Thrown when a pool has no recorded factory, its recorded factory does not authenticate it or differs\n   *         from the supplied factory, or its pool family is unsupported for the command.\n   * @param _pool Invalid pool address.\n   */\n  error InvalidPool(address _pool);\n\n  /**\n   * @notice Thrown when a V2 pool's token balance is below its recorded input reserve.\n   * @param _pool Pool with invalid reserves.\n   */\n  error InvalidReserves(address _pool);\n\n  /// @notice Thrown when a CL swap reports a positive output-token delta.\n  error InvalidSwapDeltas();\n\n  /**\n   * @notice Thrown when an exact-input swap receives less than its minimum.\n   * @param _minimum Minimum output requested.\n   * @param _received Actual output received.\n   */\n  error TooLittleReceived(uint256 _minimum, uint256 _received);\n\n  /// @notice Thrown when a swap requires more input than the command authorized.\n  error TooMuchRequested();\n\n  // ============================== Functions ==============================\n\n  /**\n   * @notice Runs an ordered command batch as one atomic call.\n   * @param _commands One byte per command, index-aligned with `_inputs`.\n   * @param _inputs ABI-encoded arguments for each command.\n   * @param _deadline Timestamp after which the batch reverts.\n   */\n  function execute(bytes calldata _commands, bytes[] calldata _inputs, uint256 _deadline) external payable;\n\n  /**\n   * @notice Pays the input token owed to the currently authenticated CL pool.\n   * @param _amount0Delta Signed token0 amount owed to or sent by the pool.\n   * @param _amount1Delta Signed token1 amount owed to or sent by the pool.\n   * @param _data Callback payer and input authorization encoded by the active swap command.\n   */\n  function uniswapV3SwapCallback(int256 _amount0Delta, int256 _amount1Delta, bytes calldata _data) external;\n\n  /**\n   * @notice Returns the account whose positions and approvals commands act for.\n   * @return _sender Logical sender for the current batch.\n   */\n  function msgSender() external view returns (address _sender);\n\n  // ============================== Variable getters ==============================\n\n  /**\n   * @notice Wrapped native token used by wrap and unwrap commands.\n   * @return _weth The wrapped native token, or the zero address on a chain with no wrapped-native token, where\n   *         `WRAP_ETH` and `UNWRAP_WETH` are disabled.\n   */\n  function WETH() external view returns (IWETH _weth);\n\n  /**\n   * @notice Leaf Voter used to validate gauge targets and resolve their reward contracts.\n   * @dev The zero address on a lite deployment with no voting system, where the gauge staking and claim commands\n   *      revert with `CommandDisabled`.\n   * @return _leafVoter The leaf Voter.\n   */\n  function LEAF_VOTER() external view returns (ILeafVoter _leafVoter);\n\n  /**\n   * @notice Token delivered to recipients by a gauge-emissions claim on this chain: the `ReceiptToken` on leaf\n   *         deployments, or the canonical `TOKEN` on root, where the receipt is redeemed for `TOKEN` in the same\n   *         transaction.\n   * @return _emissionToken The gauge-emissions token this router custodies and sweeps.\n   */\n  function EMISSION_TOKEN() external view returns (IERC20 _emissionToken);\n\n  /**\n   * @notice Interchain account router used by the cross-chain commands to derive accounts and dispatch commitments.\n   * @dev The zero address on a lite deployment with no cross-chain layer, where every command that derives an\n   *      interchain account reverts with `CommandDisabled`. A `BRIDGE_TOKEN` naming a direct recipient never reads\n   *      this router, so it stays available there.\n   * @return _icaRouter The interchain account router.\n   */\n  function ICA_ROUTER() external view returns (IInterchainAccountRouter _icaRouter);\n\n  /**\n   * @notice Registry used to authenticate pools, target factories, and gauge-to-factory relationships.\n   * @return _factoryRegistry Factory registry used by venue-sensitive commands.\n   */\n  function FACTORY_REGISTRY() external view returns (IFactoryRegistry _factoryRegistry);\n\n  /**\n   * @notice ERC20 entry point of the chain's native asset, on chains where one exists; the zero address elsewhere.\n   * @dev The token's balance is the account's native balance expressed in the token's own decimals, so spend\n   *      resolution caps it at the batch's own native converted through `NATIVE_ERC20_SCALE`: spending the full\n   *      balance would drain the pre-batch native the batch must preserve and revert the closure.\n   *      The closing sweep skips its entry point entirely and returns the batch's portion through the native refund,\n   *      since some implementations reject a zero-value `transfer`; a recipient that rejects that refund is paid\n   *      through this entry point instead. On implementations that reject value-less transfers the ERC20-style\n   *      commands on this token revert mid-batch too; that is the token's own behavior, not the router's.\n   *      Never transfer or pre-fund this token ahead of `execute`: provide it as `msg.value` or pull it through\n   *      `FUND_ERC20` during the active batch. Value the router already holds when a batch opens counts as pre-batch\n   *      native, is excluded from batch custody, and cannot be recovered.\n   * @return _nativeErc20 The native ERC20, or the zero address when the chain has none.\n   */\n  function NATIVE_ERC20() external view returns (IERC20 _nativeErc20);\n\n  /**\n   * @notice Native value represented by one raw unit of the native ERC20, derived from the token's decimals.\n   * @dev Some chains express the same native asset in different precisions per interface: eighteen decimals for\n   *      `address.balance` and `msg.value`, the token's own decimals for `balanceOf` and `transfer`. Every place\n   *      that mixes the two representations converts through this factor: the batch's spendable native — less any\n   *      committed message fee — converts to the native ERC20 decimals rounding down, so a full spend can never reach the\n   *      pre-batch native; a native refund paid through the native ERC20 also floors, leaving dust the token cannot\n   *      express. One on an eighteen-decimal native ERC20, where both interfaces share raw values.\n   * @return _nativeErc20Scale Native value per raw native ERC20 unit, or zero when the chain has no native ERC20.\n   */\n  function NATIVE_ERC20_SCALE() external view returns (uint256 _nativeErc20Scale);\n\n  /**\n   * @notice Whether this deployment is the root chain, where `VotingEscrow` and the Relay exist.\n   * @dev Gates the root-only `CREATE_STAKE` and `DEPOSIT_RELAY` commands; derived at construction from whether the\n   *      local chain id equals the orchestrator's `ROOT_CHAIN_ID`.\n   * @return _isRoot True on the root deployment, false on a leaf.\n   */\n  function IS_ROOT() external view returns (bool _isRoot);\n\n  /**\n   * @notice VotingEscrow that `CREATE_STAKE` and `DEPOSIT_RELAY` act on, resolved from the root Voter's\n   *         `VOTING_ESCROW()`; the zero address on a leaf deployment.\n   * @return _stakingEscrow The VotingEscrow, or the zero address on a leaf.\n   */\n  function STAKING_ESCROW() external view returns (IVotingEscrow _stakingEscrow);\n\n  /**\n   * @notice Token `CREATE_STAKE` stakes into a new sAERO, resolved from `STAKING_ESCROW.TOKEN()`; zero on a leaf.\n   * @return _stakingToken The staking token, or the zero address on a leaf.\n   */\n  function STAKING_TOKEN() external view returns (IERC20 _stakingToken);\n\n  /**\n   * @notice RelayFactoryRegistry that `DEPOSIT_RELAY` authenticates a caller-selected relay's factory against; the\n   *         zero address on a leaf deployment, where the command is gated off.\n   * @return _relayFactoryRegistry The RelayFactoryRegistry, or the zero address on a leaf.\n   */\n  function RELAY_FACTORY_REGISTRY() external view returns (IRelayFactoryRegistry _relayFactoryRegistry);\n}\n"},"V3/src/interfaces/token/ITokenExtensions.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IBaseTokenExtensions} from 'V3/interfaces/token/IBaseTokenExtensions.sol';\n\n/// @title ITokenExtensions\n/// @notice Interface for Token custom behavior not covered by the ERC20 interface.\ninterface ITokenExtensions is IBaseTokenExtensions {\n  /// @notice Thrown when a caller other than the minter tries to mint tokens.\n  error NotMinter();\n\n  /// @notice Thrown when a caller without burn permission tries to burn tokens.\n  error CallerNotBurner();\n\n  /// @notice Mints tokens to an account.\n  /// @param _to The account that receives the minted tokens.\n  /// @param _amount The amount of tokens to mint.\n  function mint(address _to, uint256 _amount) external;\n\n  /// @notice Burns tokens held by an authorized protocol burner.\n  /// @param _amount The amount of tokens to burn.\n  function burn(uint256 _amount) external;\n\n  /// @notice Returns the minter address.\n  /// @return _minter The address allowed to mint tokens.\n  function MINTER() external view returns (address _minter);\n\n  /// @notice Returns the voting escrow address.\n  /// @return _votingEscrow The address allowed to burn tokens.\n  function VOTING_ESCROW() external view returns (address _votingEscrow);\n\n  /// @notice Returns the Aerodrome migration address.\n  /// @return _migration The Aerodrome migration pre-mint recipient and burner.\n  function MIGRATION() external view returns (address _migration);\n\n  /// @notice Returns the Velodrome migration entrypoint address.\n  /// @return _velodromeMigration The Velodrome pre-mint recipient and burner.\n  function VELODROME_MIGRATION() external view returns (address _velodromeMigration);\n}\n"},"V3/src/metarouter/libraries/LiquidityLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {Math} from '@openzeppelin/contracts/utils/math/Math.sol';\n\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {V2PoolLib} from 'V3/metarouter/libraries/V2PoolLib.sol';\n\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IPoolFactory} from 'V3/interfaces/factories/IPoolFactory.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IPool} from 'V3/interfaces/pools/IPool.sol';\n\n/**\n * @title LiquidityLib\n * @notice V2 liquidity command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode while executing in the router's storage context. Funding, tracking, and\n *      logical-sender resolution go through `FundsLib` / `MetarouterState`; the `FactoryRegistry` is passed in because\n *      a library cannot read the router's immutables.\n *\n *      `addLiquidity` takes a factory and the token pair, requiring current approval only when creating a pool;\n *      both liquidity commands authenticate existing pools through their permanent `FactoryRegistry` records,\n *      the single path shared by legacy and V3 V2 pools. Volatile and stable variants differ only by deploying\n *      factory, so no stability flag is read: the proportional reserve quote and the per-token minimums are\n *      variant-agnostic. The pools are push-first, so tokens are transferred in before `mint`/`burn` is called.\n */\nlibrary LiquidityLib {\n  /**\n   * @notice Adds liquidity to a validated V2 pool and mints LP tokens to the recipient.\n   * @dev Resolves the pool through the selected factory, creating it only when the factory is approved and the caller\n   *      opted in. Validates the pool's recorded factory, membership, family, and requested pair. Every `A`/`B` input\n   *      refers to the token the caller supplied under that letter, so a pair given in reverse order only realigns the\n   *      reserves. Amounts are adjusted to the pool's current reserve ratio; unused tokens are returned at the end of\n   *      the batch. An unseeded pool is skimmed before funding so a stray pre-funding cannot revert the bootstrap. The\n   *      pool's mint result must meet the caller's LP minimum. LP tokens minted to the Metarouter can be used by a\n   *      later command or returned at batch end.\n   * @param _input ABI-encoded `AddLiquidityParams`.\n   * @param _factoryRegistry Factory registry that validates the selected factory (the router's immutable).\n   */\n  function addLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.AddLiquidityParams memory _params = abi.decode(_input, (IMetarouter.AddLiquidityParams));\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    address _pool = IPoolFactory(_params.factory).getPool(_params.tokenA, _params.tokenB);\n    if (_pool == address(0)) {\n      // Revert unless the caller explicitly allows creating and seeding a new pool.\n      if (!_params.createPool) revert IMetarouter.PoolNotFound();\n      if (!_factoryRegistry.isTargetFactoryApproved(_params.factory)) {\n        revert IMetarouter.FactoryNotApproved();\n      }\n      _pool = IPoolFactory(_params.factory).createPool(_params.tokenA, _params.tokenB);\n    }\n\n    if (V2PoolLib.validatePool(_pool, _factoryRegistry) != _params.factory) {\n      revert IMetarouter.InvalidPool(_pool);\n    }\n\n    // slither-disable-next-line unused-return\n    (,, uint256 _reserveA, uint256 _reserveB, address _poolToken0, address _poolToken1) = IPool(_pool).metadata();\n    if (_params.tokenA != _poolToken0 || _params.tokenB != _poolToken1) {\n      if (_params.tokenA != _poolToken1 || _params.tokenB != _poolToken0) {\n        revert IMetarouter.PoolTokenMismatch(_pool);\n      }\n      // The pair arrived in reverse pool order; realign the reserves so the quotes follow the caller's order.\n      (_reserveA, _reserveB) = (_reserveB, _reserveA);\n    }\n\n    uint256 _amountA = FundsLib.fund(_params.tokenA, _params.spendA, _params.payerAIsUser);\n    uint256 _amountB = FundsLib.fund(_params.tokenB, _params.spendB, _params.payerBIsUser);\n\n    // A seeded pool trims one side to the live ratio; the smaller quote wins so neither side\n    // exceeds what was funded.\n    if (_reserveA != 0 && _reserveB != 0) {\n      // Preserve the established floored forward quote whenever its quotient fits uint256. `mulDiv` can represent\n      // that quotient iff the product's high word is below the denominator. Otherwise quoting first would revert even\n      // though the imbalanced pool can accept a valid tokenB-limited deposit, so calculate only the reverse quote.\n      // The low word is intentionally unused: the quotient's representability depends only on the high word.\n      // slither-disable-next-line unused-return\n      (uint256 _amountBQuoteHigh,) = Math.mul512(_amountA, _reserveB);\n      if (_amountBQuoteHigh < _reserveA) {\n        uint256 _amountBOptimal = Math.mulDiv(_amountA, _reserveB, _reserveA);\n        if (_amountBOptimal <= _amountB) _amountB = _amountBOptimal;\n        else _amountA = Math.mulDiv(_amountB, _reserveA, _reserveB);\n      } else {\n        _amountA = Math.mulDiv(_amountB, _reserveA, _reserveB);\n      }\n    }\n\n    // The minimums bound the amount the router commits to the pool.\n    if (_amountA < _params.amountAMin) revert IMetarouter.InsufficientAmountA();\n    if (_amountB < _params.amountBMin) revert IMetarouter.InsufficientAmountB();\n\n    // Before the first deposit, skim only if either token has a balance.\n    if (_reserveA == 0 && _reserveB == 0) {\n      if (IERC20(_poolToken0).balanceOf(_pool) != 0 || IERC20(_poolToken1).balanceOf(_pool) != 0) {\n        IPool(_pool).skim(MetarouterState.msgSender());\n      }\n    }\n\n    FundsLib.push(_params.tokenA, _pool, _amountA);\n    FundsLib.push(_params.tokenB, _pool, _amountB);\n\n    if (_params.recipient == address(this)) MetarouterState.trackERC20(_pool);\n    uint256 _liquidity = IPool(_pool).mint(_params.recipient);\n    if (_liquidity < _params.liquidityMin) {\n      revert IMetarouter.InsufficientLiquidityMinted(_params.liquidityMin, _liquidity);\n    }\n  }\n\n  /**\n   * @notice Burns LP tokens of a validated V2 pool and sends the underlying tokens to the recipient.\n   * @dev A router recipient tracks both pool tokens so a later command can consume them and closure sweeps leftovers.\n   * @param _input ABI-encoded `RemoveLiquidityParams`.\n   * @param _factoryRegistry Factory registry that validates the pool target (the router's immutable).\n   */\n  function removeLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.RemoveLiquidityParams memory _params = abi.decode(_input, (IMetarouter.RemoveLiquidityParams));\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // slither-disable-next-line unused-return\n    V2PoolLib.validatePool(_params.pool, _factoryRegistry);\n\n    uint256 _liquidity = FundsLib.fund(_params.pool, _params.lpSpend, _params.payerIsUser);\n\n    if (_params.recipient == address(this)) {\n      (address _token0, address _token1) = IPool(_params.pool).tokens();\n      MetarouterState.trackERC20(_token0);\n      MetarouterState.trackERC20(_token1);\n    }\n\n    FundsLib.push(_params.pool, _params.pool, _liquidity);\n    (uint256 _amount0, uint256 _amount1) = IPool(_params.pool).burn(_params.recipient);\n\n    if (_amount0 < _params.amount0Min) revert IMetarouter.InsufficientAmount0();\n    if (_amount1 < _params.amount1Min) revert IMetarouter.InsufficientAmount1();\n  }\n}\n"},"V3/src/interfaces/factories/IGaugeFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IAccessControl} from '@openzeppelin/contracts/access/IAccessControl.sol';\n\ninterface IGaugeFactory is IAccessControl {\n  /**\n   * @notice Constructor wiring for a GaugeFactory.\n   * @param leafVoter The LeafVoter gauges authorize at runtime. The GaugeManager is read from it.\n   * @param votingRewardsFactory The VotingRewardsFactory deploying each gauge's VotingRewardsManager.\n   * @param isStable Whether the factory creates stable-pool gauges.\n   * @param capAdmin Initial CAP_ADMIN_ROLE holder.\n   * @param referralAdmin Initial REFERRAL_ADMIN_ROLE holder.\n   * @param penaltyAdmin Initial PENALTY_ADMIN_ROLE holder.\n   * @param capOperator Initial CAP_OPERATOR_ROLE holder.\n   * @param defaultCap Factory-wide default emission cap.\n   * @param operatorMinCap Minimum cap CAP_OPERATOR_ROLE may set.\n   * @param operatorMaxCap Maximum cap CAP_OPERATOR_ROLE may set.\n   * @param maxMinStakeBlocks Upper bound on per-gauge minimum staking period overrides.\n   * @param gaugeTapeManagerAdmin Initial `GAUGE_TAPE_MANAGER_ADMIN_ROLE` holder.\n   * @param gaugeTapeManager Initial `GAUGE_TAPE_MANAGER_ROLE` holder.\n   */\n  struct InitParams {\n    address leafVoter;\n    address votingRewardsFactory;\n    bool isStable;\n    address capAdmin;\n    address referralAdmin;\n    address penaltyAdmin;\n    address capOperator;\n    uint128 defaultCap;\n    uint128 operatorMinCap;\n    uint128 operatorMaxCap;\n    uint256 maxMinStakeBlocks;\n    address gaugeTapeManagerAdmin;\n    address gaugeTapeManager;\n  }\n\n  /**\n   * @notice Referral configuration for a gauge.\n   * @param referral Address receiving the referral share.\n   * @param share Referral share in PIPS.\n   */\n  struct ReferralConfig {\n    address referral;\n    uint256 share;\n  }\n\n  /**\n   * @notice Early unstake penalty configuration shared by gauges created by this factory.\n   * @param minStakeBlocks Factory-wide default minimum staking period in blocks.\n   * @param penaltyRate Penalty rate in PIPS. Zero disables the penalty.\n   */\n  struct PenaltyConfig {\n    uint256 minStakeBlocks;\n    uint256 penaltyRate;\n  }\n\n  /**\n   * @notice Emitted when a new gauge is deployed.\n   * @param _gauge Address of the deployed gauge.\n   * @param _pool Address of the pool or staking token.\n   * @param _isPool Whether the staking token is a V2 pool.\n   */\n  event GaugeCreated(address indexed _gauge, address indexed _pool, bool _isPool);\n\n  /**\n   * @notice Emitted when a gauge emission cap is updated.\n   * @param _gauge Address of the gauge.\n   * @param _cap Stored cap value written for the gauge.\n   * @param _caller Address that updated the cap.\n   */\n  event EmissionCapSet(address indexed _gauge, uint128 _cap, address indexed _caller);\n\n  /**\n   * @notice Emitted when fee flushing fails during forced gauge deactivation.\n   * @param _gauge Address of the gauge whose fee flush failed.\n   */\n  event FeeFlushFailed(address indexed _gauge);\n\n  /**\n   * @notice Emitted when the default cap is updated.\n   * @param _cap New default cap.\n   */\n  event DefaultCapSet(uint128 _cap);\n\n  /**\n   * @notice Emitted when the operator cap range is updated.\n   * @param _minCap New minimum cap allowed for operators.\n   * @param _maxCap New maximum cap allowed for operators.\n   */\n  event OperatorCapRangeSet(uint128 _minCap, uint128 _maxCap);\n\n  /**\n   * @notice Emitted when the maximum referral share cap is updated.\n   * @param _cap New maximum share cap in PIPS.\n   */\n  event MaxShareCapSet(uint256 _cap);\n\n  /**\n   * @notice Emitted when a gauge referral configuration is updated.\n   * @param _gauge Address of the gauge.\n   * @param _referral Address receiving the referral share.\n   * @param _share Referral share in PIPS.\n   */\n  event ReferralConfigSet(address indexed _gauge, address indexed _referral, uint256 _share);\n\n  /**\n   * @notice Emitted when the factory-wide penalty configuration is updated.\n   * @param _minStakeBlocks New factory-wide minimum staking period in blocks.\n   * @param _penaltyRate New penalty rate in PIPS.\n   */\n  event PenaltyConfigSet(uint256 _minStakeBlocks, uint256 _penaltyRate);\n\n  /**\n   * @notice Emitted when a gauge minimum staking period override is updated.\n   * @param _gauge Address of the gauge.\n   * @param _minStakeBlocks New per-gauge minimum staking period override in blocks.\n   */\n  event MinStakeBlocksSet(address indexed _gauge, uint256 _minStakeBlocks);\n\n  /**\n   * @notice Emitted when the gauge tape pointer and its gas limit are set.\n   * @param _gaugeTape The gauge tape relayed to. The zero address disables the relay.\n   * @param _gasLimit The gas budget for each relayed record call.\n   */\n  event GaugeTapeSet(address indexed _gaugeTape, uint32 _gasLimit);\n\n  /**\n   * @notice Thrown when a caller is not authorized.\n   */\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a zero address is invalid.\n   */\n  error ZeroAddress();\n\n  /**\n   * @notice Thrown when an operator cap is outside the allowed range.\n   */\n  error CapOutOfOperatorRange();\n\n  /**\n   * @notice Thrown when a cap range is invalid.\n   */\n  error InvalidCapRange();\n\n  /**\n   * @notice Thrown when attempting to set the default cap to zero.\n   */\n  error ZeroDefaultCap();\n\n  /**\n   * @notice Thrown when a referral share exceeds the maximum share cap.\n   */\n  error ShareExceedsMax();\n\n  /**\n   * @notice Thrown when the maximum share cap exceeds `MAX_PIPS`.\n   */\n  error InvalidMaxShareCap();\n\n  /**\n   * @notice Thrown when a penalty rate exceeds `MAX_PIPS`.\n   */\n  error InvalidPenaltyRate();\n\n  /**\n   * @notice Thrown when a minimum staking period exceeds MAX_MIN_STAKE_BLOCKS.\n   */\n  error InvalidMinStakeBlocks();\n\n  /**\n   * @notice Thrown when an address is not a gauge created by this factory.\n   */\n  error InvalidGauge();\n\n  /**\n   * @notice Thrown when a referral configuration is invalid.\n   */\n  error InvalidReferral();\n\n  /**\n   * @notice Thrown when the gauges and caps arrays have different lengths.\n   */\n  error LengthMismatch();\n\n  /**\n   * @notice Thrown when the gas left is equal to or below the gas limit set for the external call.\n   */\n  error InsufficientGasForCall();\n\n  /**\n   * @notice Thrown when a zero gas limit is set for the gauge tape relay.\n   */\n  error ZeroGasLimit();\n\n  /**\n   * @notice Relays a gauge's accumulator reading to the gauge tape through a gas-capped fail-open call.\n   * @dev Returns silently when the tape is unset or the caller is not a gauge of this factory, and\n   *      ignores the capped call's outcome, so the gauge action never reverts through the tape. The\n   *      one deliberate revert is the gas guard: the transaction fails when the gas left cannot\n   *      cover the configured budget, closing the starvation path.\n   * @param _rewardPerToken The calling gauge's `rewardPerTokenStored` after the advance.\n   */\n  function recordGaugeTape(uint256 _rewardPerToken) external;\n\n  /**\n   * @notice Sets the gauge tape pointer and the gas budget for each relayed record call.\n   * @dev Only callable by a `GAUGE_TAPE_MANAGER_ROLE` holder. A zero tape disables the relay; a zero gas limit\n   *      reverts. Configure with headroom over the tape's worst record cost: the gas guard admits a\n   *      caller holding just over the limit, and the capped call then receives up to a sixty fourth\n   *      less than it.\n   * @param _gaugeTape The gauge tape to relay to.\n   * @param _gasLimit The gas budget for each relayed record call.\n   */\n  function setGaugeTape(address _gaugeTape, uint32 _gasLimit) external;\n\n  /**\n   * @notice Deploy a gauge for `_target` together with its VotingRewardsManager.\n   * @dev Only callable by the GaugeManager. The VotingRewardsManager is\n   *      deployed through the VotingRewardsFactory against the precomputed\n   *      gauge address before the gauge itself, seeded with the pool's pair\n   *      tokens as the initial reward tokens. Unknown params are ignored.\n   * @param _target Address of the pool the gauge points at.\n   * @param _factoryData Optional encoded creation parameters.\n   * @return _gauge Address of the deployed gauge.\n   * @return _rewards Address of the deployed VotingRewardsManager.\n   */\n  function createGauge(address _target, bytes calldata _factoryData) external returns (address _gauge, address _rewards);\n\n  /**\n   * @notice Set the default emission cap for future gauges.\n   * @dev Existing gauges retain their stored emission caps.\n   * @param _cap New default cap.\n   */\n  function setDefaultCap(uint128 _cap) external;\n\n  /**\n   * @notice Set a per-gauge cap.\n   * @param _gauge Address of the gauge.\n   * @param _cap New stored cap value.\n   */\n  function setEmissionCap(address _gauge, uint128 _cap) external;\n\n  /**\n   * @notice Set per-gauge caps in one batch.\n   * @dev Applies the `setEmissionCap` checks to each entry. Any failing\n   *      entry reverts the whole batch.\n   * @param _gauges Addresses of the gauges.\n   * @param _caps New stored cap values, index-matched to `_gauges`.\n   */\n  function setEmissionCaps(address[] calldata _gauges, uint128[] calldata _caps) external;\n\n  /**\n   * @notice Sets a gauge's emission cap to zero without requiring a successful fee flush.\n   * @dev Only callable by the emergency council.\n   * @param _gauge Address of the gauge to deactivate.\n   */\n  function clearEmissionCap(address _gauge) external;\n\n  /**\n   * @notice Set the inclusive range within which CAP_OPERATOR_ROLE may set per-gauge caps.\n   * @param _minCap New minimum cap.\n   * @param _maxCap New maximum cap.\n   */\n  function setOperatorCapRange(uint128 _minCap, uint128 _maxCap) external;\n\n  /**\n   * @notice Set the factory-wide ceiling on per-gauge referral shares.\n   * @param _cap New maximum referral share cap in PIPS.\n   */\n  function setMaxShareCap(uint256 _cap) external;\n\n  /**\n   * @notice Set or clear referral config for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @param _referral Address receiving the referral share.\n   * @param _share Referral share in PIPS.\n   */\n  function setReferralConfig(address _gauge, address _referral, uint256 _share) external;\n\n  /**\n   * @notice Set the factory-wide penalty defaults.\n   * @param _minStakeBlocks New factory-wide minimum staking period in blocks.\n   * @param _penaltyRate New penalty rate in PIPS.\n   */\n  function setPenaltyConfig(uint256 _minStakeBlocks, uint256 _penaltyRate) external;\n\n  /**\n   * @notice Set a per-gauge minimum staking period override.\n   * @param _gauge Address of the gauge.\n   * @param _minStakeBlocks New minimum staking period override in blocks.\n   */\n  function setMinStakeBlocks(address _gauge, uint256 _minStakeBlocks) external;\n\n  /**\n   * @notice Initial value of `maxShareCap`.\n   * @return _defaultMaxShareCap Default max share cap in PIPS.\n   */\n  function DEFAULT_MAX_SHARE_CAP() external view returns (uint256 _defaultMaxShareCap);\n\n  /**\n   * @notice Initial value of `minStakeBlocks`.\n   * @return _defaultMinStakeBlocks Default minimum staking period in blocks.\n   */\n  function DEFAULT_MIN_STAKE_BLOCKS() external view returns (uint256 _defaultMinStakeBlocks);\n\n  /**\n   * @notice Initial value of `penaltyRate`.\n   * @return _defaultPenaltyRate Default penalty rate in PIPS.\n   */\n  function DEFAULT_PENALTY_RATE() external view returns (uint256 _defaultPenaltyRate);\n\n  /**\n   * @notice OZ AccessControl role for cap administration.\n   * @return _capAdminRole Cap admin role identifier.\n   */\n  function CAP_ADMIN_ROLE() external view returns (bytes32 _capAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for referral configuration.\n   * @return _referralAdminRole Referral admin role identifier.\n   */\n  function REFERRAL_ADMIN_ROLE() external view returns (bytes32 _referralAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for penalty configuration.\n   * @return _penaltyAdminRole Penalty admin role identifier.\n   */\n  function PENALTY_ADMIN_ROLE() external view returns (bytes32 _penaltyAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for per-gauge cap adjustments.\n   * @return _capOperatorRole Cap operator role identifier.\n   */\n  function CAP_OPERATOR_ROLE() external view returns (bytes32 _capOperatorRole);\n\n  /**\n   * @notice OZ AccessControl role administering the gauge tape manager role.\n   * @return _gaugeTapeManagerAdminRole Gauge tape admin role identifier.\n   */\n  function GAUGE_TAPE_MANAGER_ADMIN_ROLE() external view returns (bytes32 _gaugeTapeManagerAdminRole);\n\n  /**\n   * @notice OZ AccessControl role for the gauge tape pointer and its gas limit.\n   * @return _gaugeTapeManagerRole Gauge tape manager role identifier.\n   */\n  function GAUGE_TAPE_MANAGER_ROLE() external view returns (bytes32 _gaugeTapeManagerRole);\n\n  /**\n   * @notice Address of the LeafVoter.\n   * @return _leafVoter Address of the LeafVoter.\n   */\n  function LEAF_VOTER() external view returns (address _leafVoter);\n\n  /**\n   * @notice GaugeManager authorized to call `createGauge`.\n   * @return _gaugeManager Address of the GaugeManager.\n   */\n  function GAUGE_MANAGER() external view returns (address _gaugeManager);\n\n  /**\n   * @notice VotingRewardsFactory deploying each gauge's VotingRewardsManager.\n   * @return _votingRewardsFactory Address of the VotingRewardsFactory.\n   */\n  function VOTING_REWARDS_FACTORY() external view returns (address _votingRewardsFactory);\n\n  /**\n   * @notice Address of the Gauge implementation used for deterministic clones.\n   * @return _implementation Address of the Gauge implementation.\n   */\n  function IMPLEMENTATION() external view returns (address _implementation);\n\n  /**\n   * @notice Computes the deterministic clone address for the gauge deployed\n   *         over `_pool`.\n   * @dev The salt derives from the pool address, so the prediction is fixed\n   *      and unique per pool. The registry links at most one gauge per\n   *      target, so no second deployment ever needs a fresh address.\n   * @param _pool Address of the pool or staking token.\n   * @return _gauge Predicted gauge address.\n   */\n  function computeGaugeAddress(address _pool) external view returns (address _gauge);\n\n  /**\n   * @notice True if this factory creates stable-pool gauges.\n   * @return _isStable Whether gauges created by this factory are for stable pools.\n   */\n  function IS_STABLE() external view returns (bool _isStable);\n\n  /**\n   * @notice Upper bound on per-gauge minimum staking period overrides.\n   * @return _maxMinStakeBlocks Maximum minimum staking period in blocks.\n   */\n  function MAX_MIN_STAKE_BLOCKS() external view returns (uint256 _maxMinStakeBlocks);\n\n  /**\n   * @notice String identifying the gauge type produced by this factory.\n   * @return _gaugeType Gauge type string.\n   */\n  function GAUGE_TYPE() external view returns (string memory _gaugeType);\n\n  /**\n   * @notice True if `_gauge` was deployed by this factory.\n   * @param _gauge Address to check.\n   * @return _isGauge True if `_gauge` was deployed by this factory.\n   */\n  function isGauge(address _gauge) external view returns (bool _isGauge);\n\n  /**\n   * @notice Emission cap stored for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @return _cap Stored emission cap.\n   */\n  function emissionCap(address _gauge) external view returns (uint128 _cap);\n\n  /**\n   * @notice Factory-wide default cap.\n   * @return _defaultCap Current default cap.\n   */\n  function defaultCap() external view returns (uint128 _defaultCap);\n\n  /**\n   * @notice Minimum cap CAP_OPERATOR_ROLE may set on any gauge.\n   * @return _operatorMinCap Operator minimum cap.\n   */\n  function operatorMinCap() external view returns (uint128 _operatorMinCap);\n\n  /**\n   * @notice Maximum cap CAP_OPERATOR_ROLE may set on any gauge.\n   * @return _operatorMaxCap Operator maximum cap.\n   */\n  function operatorMaxCap() external view returns (uint128 _operatorMaxCap);\n\n  /**\n   * @notice Factory-wide ceiling on per-gauge referral shares.\n   * @return _maxShareCap Maximum referral share cap in PIPS.\n   */\n  function maxShareCap() external view returns (uint256 _maxShareCap);\n\n  /**\n   * @notice Returns the referral configuration for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @return _referral Address receiving the referral share.\n   * @return _share Referral share in PIPS.\n   */\n  function referralConfig(address _gauge) external view returns (address _referral, uint256 _share);\n\n  /**\n   * @notice Factory-wide early unstake penalty defaults.\n   * @return _config Current penalty configuration.\n   */\n  function penaltyConfig() external view returns (PenaltyConfig memory _config);\n\n  /**\n   * @notice Effective penalty config for `_gauge`.\n   * @param _gauge The gauge to query.\n   * @return The penalty config with the effective minimum-stake threshold.\n   */\n  function effectivePenaltyConfig(address _gauge) external view returns (PenaltyConfig memory);\n\n  /**\n   * @notice Resolves the effective minimum-stake threshold for `_gauge`.\n   * @param _gauge Address of the gauge.\n   * @return _minStakeBlocks Effective minimum staking period in blocks.\n   */\n  function minStakeBlocks(address _gauge) external view returns (uint256 _minStakeBlocks);\n\n  /**\n   * @notice The gauge tape record calls are relayed to. The zero address disables the relay.\n   * @return _gaugeTape The gauge tape.\n   */\n  function gaugeTape() external view returns (address _gaugeTape);\n\n  /**\n   * @notice The gas budget for each relayed record call.\n   * @return _gasLimit The gas budget.\n   */\n  function gaugeTapeGasLimit() external view returns (uint32 _gasLimit);\n}\n"},"V3/src/interfaces/relay/IRelayVoteAdapter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title  IRelayVoteAdapter\n * @notice Translates the Relay's canonical cast — an (against, for, abstain) split — into the\n *         Governor's ABI, so a Governor upgrade is an adapter swap instead of a Relay redeploy.\n * @dev    Consulted by STATICCALL only and MUST hold no storage (immutables are fine): the EVM then\n *         guarantees an adapter cannot write, log or reenter. The adapter never names the call\n *         target — the Relay sends the returned calldata to its own stored Governor, and only when\n *         its selector is the fractional cast — so a hostile adapter can miscode a vote but never\n *         make the Relay call anything else as itself. `proposalSnapshot`\n *         MUST return a timestamp (the PT and VE checkpoint clock); an adapter for a block-number\n *         Governor must convert.\n */\ninterface IRelayVoteAdapter {\n  /// @notice Thrown when a split component does not fit the width the Governor dialect encodes.\n  error UnrepresentableWeight();\n\n  /// @notice The timepoint `_governor` snapshots voting power at for `_proposalId`.\n  /// @param _governor Governor the proposal lives on.\n  /// @param _proposalId Proposal being queried.\n  /// @return _timestamp The proposal's snapshot timestamp.\n  function proposalSnapshot(address _governor, uint256 _proposalId) external view returns (uint256 _timestamp);\n\n  /// @notice Encode one partial cast into the Governor dialect.\n  /// @param _proposalId Proposal being voted on.\n  /// @param _tokenId The Relay's sAERO whose weight backs the cast.\n  /// @param _against Weight cast against.\n  /// @param _for Weight cast in favor.\n  /// @param _abstain Weight cast as abstention.\n  /// @param _reason Free-form reason string to attach.\n  /// @return _callData Calldata the Relay sends to its stored Governor, verbatim.\n  function encodeCast(\n    uint256 _proposalId,\n    uint256 _tokenId,\n    uint256 _against,\n    uint256 _for,\n    uint256 _abstain,\n    string calldata _reason\n  ) external view returns (bytes memory _callData);\n}\n"},"V3/src/metarouter/libraries/ClPositionLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nimport {ClResolverLib} from 'V3/metarouter/libraries/ClResolverLib.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {INonfungiblePositionManager} from 'V3/interfaces/external/INonfungiblePositionManager.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title ClPositionLib\n * @notice Concentrated-liquidity position command handlers for the Metarouter: mint, increase, decrease, collect, and\n *         burn.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode but runs in its storage context. Funding, custody tracking, sender resolution, and\n *      the in-flight NFT slots go through `MetarouterState` / `FundsLib`; the registry is passed in because a library\n *      cannot read the router's immutables.\n *\n *      Every handler names a CL factory in its calldata and resolves that factory's position manager once, through\n *      `ClResolverLib`, so the router holds no canonical manager and each authenticated factory operates its own\n *      collection. Resolving once per command also keeps a single command from acting on two different managers, which\n *      a factory returning inconsistent values could otherwise cause.\n *\n *      `MINT_CL_POSITION` mints to the execution address and stores the new position in the in-flight slots so a later\n *      command (increase, stake, or burn) can act on it without knowing its id; the mint also tracks the position\n *      for custody so closure verifies it left even when nothing consumes it. The manager mints with `_mint`, not\n *      `_safeMint`, so the receiver hook does not fire and the handler tracks the position itself.\n *\n *      Operations on an existing position resolve the id (the zero sentinel maps to the in-flight position of the\n *      named collection), then check the caller may operate it: the router may act on a position it holds only when\n *      custody tracking proves it entered during the batch, and otherwise only on the logical sender's own position,\n *      never a third party's. Because custody, in-flight, and tracking state are all keyed by `(collection, tokenId)`,\n *      a position produced under one factory cannot be consumed by a command naming another, even when both managers\n *      issued the same id.\n */\nlibrary ClPositionLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice Mints a new CL position to a chosen recipient, or the metarouter itself to keep it for a later command.\n   * @dev Funds both pool tokens, approves the manager, mints, and clears the approvals; the manager pulls only what it\n   *      uses, so any remainder is swept at closure. Only a position minted to the metarouter is tracked for custody\n   *      and put in flight; one minted to another recipient never enters the router and is left untracked.\n   * @param _input ABI-encoded `MintClParams`.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function mintClPosition(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.MintClParams memory _params = abi.decode(_input, (IMetarouter.MintClParams));\n\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // A nonzero initial price tells the manager to create a pool; existing-pool mints use zero.\n    if (_params.sqrtPriceX96 != 0 && !_factoryRegistry.isTargetFactoryApproved(_params.factory)) {\n      revert IMetarouter.FactoryNotApproved();\n    }\n\n    INonfungiblePositionManager _positionManager =\n      ClResolverLib.resolvePositionManager(_params.factory, _factoryRegistry);\n\n    uint256 _amount0 = FundsLib.fund(_params.token0, _params.spend0, _params.payerIsUser0);\n    uint256 _amount1 = FundsLib.fund(_params.token1, _params.spend1, _params.payerIsUser1);\n\n    IERC20(_params.token0).forceApprove(address(_positionManager), _amount0);\n    IERC20(_params.token1).forceApprove(address(_positionManager), _amount1);\n\n    // slither-disable-next-line unused-return\n    (uint256 _tokenId,,,) = _positionManager.mint(\n      INonfungiblePositionManager.MintParams({\n        token0: _params.token0,\n        token1: _params.token1,\n        tickSpacing: _params.tickSpacing,\n        tickLower: _params.tickLower,\n        tickUpper: _params.tickUpper,\n        amount0Desired: _amount0,\n        amount1Desired: _amount1,\n        amount0Min: _params.amount0Min,\n        amount1Min: _params.amount1Min,\n        recipient: _params.recipient,\n        deadline: _params.deadline,\n        sqrtPriceX96: _params.sqrtPriceX96\n      })\n    );\n\n    // Held by the router: a later command stakes or burns it, and closure verifies it left. Recorded before the\n    // allowance-clearing interactions below, so the custody effect precedes them.\n    if (_params.recipient == address(this)) {\n      MetarouterState.trackNft(address(_positionManager), _tokenId);\n      MetarouterState.setInFlightNft(address(_positionManager), _tokenId);\n    }\n\n    // The manager pulls only what the mint used; clear the residual allowance it leaves.\n    IERC20(_params.token0).forceApprove(address(_positionManager), 0);\n    IERC20(_params.token1).forceApprove(address(_positionManager), 0);\n  }\n\n  /**\n   * @notice Adds liquidity to an existing position, funded from the batch balance or the logical sender.\n   * @dev Resolves the position (the zero sentinel maps to the in-flight one), reads its pool tokens, funds each, and\n   *      increases. Ownership is deliberately not checked: adding liquidity cannot harm the position's owner, and the\n   *      manager gates the caller only for a gauge-staked position (letting just the owning gauge increase it), so any\n   *      other position may be topped up while a staked one reverts. A position parked in the router is still refused,\n   *      since operating one is how a batch would reach a position it never took custody of. The manager pulls only the\n   *      used amounts, so any funded remainder stays tracked and is swept at closure; the temporary approvals are\n   *      cleared after. The position stays available, so the in-flight slots are left untouched.\n   * @param _input ABI-encoded `IncreaseClParams`.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function increaseClLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    IMetarouter.IncreaseClParams memory _params = abi.decode(_input, (IMetarouter.IncreaseClParams));\n\n    INonfungiblePositionManager _positionManager =\n      ClResolverLib.resolvePositionManager(_params.factory, _factoryRegistry);\n\n    uint256 _tokenId = MetarouterState.resolvePositionId(address(_positionManager), _params.tokenId);\n    // The router owns anything parked in it, so the manager's own authorization would wave such a position through;\n    // only the batch's custody tracking separates one this batch took from one stranded here earlier.\n    if (_positionManager.ownerOf(_tokenId) == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_positionManager), _tokenId)) revert IMetarouter.NftNotInCustody();\n    }\n\n    // slither-disable-next-line unused-return\n    (,, address _token0, address _token1,,,,,,,,) = _positionManager.positions(_tokenId);\n\n    uint256 _amount0 = FundsLib.fund(_token0, _params.spend0, _params.payerIsUser0);\n    uint256 _amount1 = FundsLib.fund(_token1, _params.spend1, _params.payerIsUser1);\n\n    IERC20(_token0).forceApprove(address(_positionManager), _amount0);\n    IERC20(_token1).forceApprove(address(_positionManager), _amount1);\n\n    // slither-disable-next-line unused-return\n    _positionManager.increaseLiquidity(\n      INonfungiblePositionManager.IncreaseLiquidityParams({\n        tokenId: _tokenId,\n        amount0Desired: _amount0,\n        amount1Desired: _amount1,\n        amount0Min: _params.amount0Min,\n        amount1Min: _params.amount1Min,\n        deadline: _params.deadline\n      })\n    );\n\n    // The manager pulls only what the increase used; clear the residual allowance it leaves.\n    IERC20(_token0).forceApprove(address(_positionManager), 0);\n    IERC20(_token1).forceApprove(address(_positionManager), 0);\n  }\n\n  /**\n   * @notice Removes liquidity from an existing position into its owed-token balance.\n   * @dev Resolves the position and checks the caller may operate it, then decreases. The manager accounts the removed\n   *      liquidity to the position's owed tokens without transferring anything out, so a later `COLLECT_CL_FEES`\n   *      extracts it; nothing is tracked here. When all liquidity is requested, its live value is read immediately\n   *      before the decrease so a third-party increase cannot leave residue, and an already-empty position is a\n   *      no-op so a remove-everything plan cannot abort on it. The position stays available, so the in-flight slots\n   *      are left untouched.\n   * @param _input ABI-encoded `(address factory, INonfungiblePositionManager.DecreaseLiquidityParams,\n   *        bool decreaseAllLiquidity)`; `tokenId` zero uses the in-flight position.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function decreaseClLiquidity(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _factory, INonfungiblePositionManager.DecreaseLiquidityParams memory _params, bool _decreaseAllLiquidity) =\n      abi.decode(_input, (address, INonfungiblePositionManager.DecreaseLiquidityParams, bool));\n\n    INonfungiblePositionManager _positionManager = ClResolverLib.resolvePositionManager(_factory, _factoryRegistry);\n\n    _params.tokenId = MetarouterState.resolvePositionId(address(_positionManager), _params.tokenId);\n    _requireOperable(_positionManager, _params.tokenId);\n\n    if (_decreaseAllLiquidity) {\n      // slither-disable-next-line unused-return\n      (,,,,,,, uint128 _currentLiquidity,,,,) = _positionManager.positions(_params.tokenId);\n      // An already empty position has nothing to remove and the manager rejects a zero decrease, so skip it as a\n      // no-op instead of aborting a batch containing a remove everything command whose liquidity is already gone.\n      if (_currentLiquidity == 0) return;\n      _params.liquidity = _currentLiquidity;\n    }\n\n    // slither-disable-next-line unused-return\n    _positionManager.decreaseLiquidity(_params);\n  }\n\n  /**\n   * @notice Collects a position's owed tokens to a recipient, or the metarouter to keep them for the batch.\n   * @dev Resolves the position and checks the caller may operate it, then collects. Collecting to the metarouter tracks\n   *      the pool tokens so a later command can consume them and closure returns any leftover; any other recipient\n   *      receives them directly, untracked. The position stays available, so the in-flight slots are left untouched.\n   * @param _input ABI-encoded `(address factory, INonfungiblePositionManager.CollectParams)`; `tokenId` zero uses the\n   *        in-flight position, and `recipient` must be non-zero.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function collectClFees(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _factory, INonfungiblePositionManager.CollectParams memory _params) =\n      abi.decode(_input, (address, INonfungiblePositionManager.CollectParams));\n\n    if (_params.recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    INonfungiblePositionManager _positionManager = ClResolverLib.resolvePositionManager(_factory, _factoryRegistry);\n\n    _params.tokenId = MetarouterState.resolvePositionId(address(_positionManager), _params.tokenId);\n    _requireOperable(_positionManager, _params.tokenId);\n\n    // A collect into the router tracks the pool tokens so closure returns any leftover.\n    if (_params.recipient == address(this)) {\n      // slither-disable-next-line unused-return\n      (,, address _token0, address _token1,,,,,,,,) = _positionManager.positions(_params.tokenId);\n      MetarouterState.trackERC20(_token0);\n      MetarouterState.trackERC20(_token1);\n    }\n\n    // slither-disable-next-line unused-return\n    _positionManager.collect(_params);\n  }\n\n  /**\n   * @notice Burns an empty position and drops it from custody and the in-flight slots.\n   * @dev Resolves the position and checks the caller may operate it, then burns. The manager requires the position to\n   *      hold no liquidity and no owed tokens. The burned id is untracked so the closure ownership check skips it rather\n   *      than reading a nonexistent token, and cleared from the in-flight slots when it was the in-flight position.\n   * @param _input ABI-encoded `(address factory, uint256 tokenId)`; `tokenId` zero uses the in-flight position.\n   * @param _factoryRegistry Registry the named CL factory is authenticated against.\n   */\n  function burnClPosition(bytes calldata _input, IFactoryRegistry _factoryRegistry) external {\n    (address _factory, uint256 _tokenId) = abi.decode(_input, (address, uint256));\n\n    INonfungiblePositionManager _positionManager = ClResolverLib.resolvePositionManager(_factory, _factoryRegistry);\n\n    _tokenId = MetarouterState.resolvePositionId(address(_positionManager), _tokenId);\n    _requireOperable(_positionManager, _tokenId);\n\n    _positionManager.burn(_tokenId);\n\n    MetarouterState.untrackNft(address(_positionManager), _tokenId);\n    MetarouterState.consumeInFlightNft(address(_positionManager), _tokenId);\n  }\n\n  /**\n   * @notice Reverts unless the logical sender may operate the position.\n   * @dev A router-held position must have entered custody during the batch, proven by its tracking, so a command cannot\n   *      operate a position stranded before the batch. Any other holder must be the logical sender; the router never\n   *      operates a third party's position.\n   * @param _positionManager Position manager holding the position.\n   * @param _tokenId Position to check.\n   */\n  function _requireOperable(INonfungiblePositionManager _positionManager, uint256 _tokenId) private view {\n    address _owner = _positionManager.ownerOf(_tokenId);\n    if (_owner == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_positionManager), _tokenId)) revert IMetarouter.NftNotInCustody();\n    } else if (_owner != MetarouterState.msgSender()) {\n      revert IMetarouter.NotPositionOwner();\n    }\n  }\n}\n"},"V3/src/metarouter/libraries/ClResolverLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {INonfungiblePositionManager} from 'V3/interfaces/external/INonfungiblePositionManager.sol';\nimport {ICLFactory} from 'V3/interfaces/factories/ICLFactory.sol';\nimport {ICLGaugeFactory} from 'V3/interfaces/factories/ICLGaugeFactory.sol';\nimport {IFactoryRegistry} from 'V3/interfaces/factories/IFactoryRegistry.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title ClResolverLib\n * @notice Resolves the position manager a CL command operates through, from the factory that owns the position's\n *         collection.\n * @dev Internal helpers inlined into the command libraries, so the router holds no canonical position manager and a\n *      second approved CL factory can be added without redeploying it. Each factory names one immutable manager and\n *      each manager names one immutable factory, so the pair authenticates itself: requiring the manager to point back\n *      leaves a factory unable to nominate another factory's collection. A factory deployed before the manager getter\n *      existed cannot name its manager itself; the gauge factory the registry pairs it with binds the same manager\n *      through its own immutable, so the resolver falls back to that record when the getter fails and the reverse\n *      link authenticates the pair all the same. What establishes the factory itself differs per entry point. A\n *      factory named in calldata must be approved or have a permanent factory-pair record in the registry. That\n *      record survives deregistration, so existing positions remain usable. A factory reached through a gauge is\n *      already fixed by write-once registry records, so that path reads the records alone.\n */\nlibrary ClResolverLib {\n  /**\n   * @notice Resolves and authenticates the position manager of a known CL factory, including a retired one.\n   * @dev Current approval admits factories before gauge pairing. The permanent pair record also authenticates a\n   *      factory after deregistration. Both are checked before calling the factory; a caller-supplied address alone\n   *      cannot cross the registry boundary. Pool creation must separately require current approval.\n   * @param _poolFactory Pool factory naming the collection the command operates on.\n   * @param _factoryRegistry Registry holding the router's factory trust boundary.\n   * @return _positionManager Authenticated position manager of `_poolFactory`.\n   */\n  function resolvePositionManager(\n    address _poolFactory,\n    IFactoryRegistry _factoryRegistry\n  ) internal view returns (INonfungiblePositionManager _positionManager) {\n    if (\n      !_factoryRegistry.isTargetFactoryApproved(_poolFactory)\n        && _factoryRegistry.targetFactoryToGaugeFactory(_poolFactory) == address(0)\n    ) {\n      revert IMetarouter.FactoryNotApproved();\n    }\n    _positionManager = _authenticatePositionManager(_poolFactory, _factoryRegistry);\n  }\n\n  /**\n   * @notice Resolves and authenticates the position manager paired with a gauge factory.\n   * @dev `GaugeLib` first proves this is the factory permanently recorded for the gauge, and the target factory it\n   *      links to is recorded write-once as well. Both records outlive `unregisterFactories`, so they anchor the\n   *      factory's identity on their own and this path takes no approval check. A caller never names either factory,\n   *      which leaves nothing for the approval set to authenticate here, and unregistering a live CL factory\n   *      therefore does not strand staked positions behind the router.\n   * @param _gaugeFactory Registry-authenticated gauge factory serving the position collection.\n   * @param _factoryRegistry Registry holding the gauge, target, and factory records.\n   * @return _positionManager Authenticated position manager of the gauge factory's linked target factory.\n   */\n  function resolveGaugePositionManager(\n    address _gaugeFactory,\n    IFactoryRegistry _factoryRegistry\n  ) internal view returns (INonfungiblePositionManager _positionManager) {\n    _positionManager = _authenticatePositionManager(\n      _factoryRegistry.gaugeFactoryToTargetFactory(_gaugeFactory), _factoryRegistry\n    );\n  }\n\n  /**\n   * @notice Resolves a CL factory's position manager and requires it to name that factory back.\n   * @dev The factory's own getter is the canonical source. A factory deployed before that getter existed reverts on\n   *      it, so the resolver then reads the manager bound by the gauge factory the registry pairs with the factory.\n   *      That pair record is write-once and the gauge factory's manager is immutable, so the fallback adds no mutable\n   *      trust, and the reverse link below still refuses a manager of another factory. A factory with neither source\n   *      names no manager at all.\n   * @param _poolFactory Pool factory whose canonical manager is resolved.\n   * @param _factoryRegistry Registry holding the factory-pair record the fallback reads.\n   * @return _positionManager Authenticated position manager of `_poolFactory`.\n   */\n  function _authenticatePositionManager(\n    address _poolFactory,\n    IFactoryRegistry _factoryRegistry\n  ) private view returns (INonfungiblePositionManager _positionManager) {\n    try ICLFactory(_poolFactory).positionManager() returns (address _namedPositionManager) {\n      _positionManager = INonfungiblePositionManager(_namedPositionManager);\n    } catch {\n      address _gaugeFactory = _factoryRegistry.targetFactoryToGaugeFactory(_poolFactory);\n      if (_gaugeFactory == address(0)) revert IMetarouter.PositionManagerNotConfigured(_poolFactory);\n      _positionManager = INonfungiblePositionManager(ICLGaugeFactory(_gaugeFactory).nft());\n    }\n    if (address(_positionManager) == address(0)) revert IMetarouter.PositionManagerNotConfigured(_poolFactory);\n\n    if (_positionManager.factory() != _poolFactory) {\n      revert IMetarouter.PositionManagerFactoryMismatch(_poolFactory, address(_positionManager));\n    }\n  }\n}\n"},"V3/src/metarouter/libraries/CrosschainLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {Math} from '@openzeppelin/contracts/utils/math/Math.sol';\n\nimport {MAX_PIPS} from 'V3/libraries/ProtocolConstants.sol';\n\nimport {Commands} from 'V3/metarouter/libraries/Commands.sol';\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\nimport {TokenRouterLib} from 'V3/metarouter/libraries/TokenRouterLib.sol';\n\nimport {IInterchainAccountRouter} from 'V3/interfaces/external/IInterchainAccountRouter.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title CrosschainLib\n * @notice Cross-chain command handlers for the Metarouter: bridging a held token, dispatching a destination plan, and\n *         redeeming held `ReceiptToken` for `TOKEN` on root.\n */\nlibrary CrosschainLib {\n  using SafeERC20 for IERC20;\n\n  /// @notice Length of the hook metadata's fixed prefix, per `StandardHookMetadata`: `[0:2]` variant, `[2:34]`\n  ///         msgValue, `[34:66]` gasLimit, `[66:86]` refund address. Optional fields follow, so this is both the\n  ///         shortest metadata carrying a refund address and the offset of the first optional field.\n  uint256 private constant _HOOK_METADATA_PREFIX_LENGTH = 86;\n\n  /**\n   * @notice Bridges a selected token or native balance to the logical sender's destination interchain account, or to\n   *         a caller-chosen recipient.\n   * @dev `token == address(0)` selects native. Any other token selects ERC20. The Warp Route must report the same\n   *      token.\n   *\n   *      The selected amount is the total bridge budget, not the delivered amount. The quoted fee is deducted from\n   *      this budget, while `maxFee` limits the deduction. The cap carries its own mode, independent of the spend: an\n   *      `Amount` cap is an absolute token figure, a `Pips` cap a ceil-rounded fraction of the resolved bridge amount.\n   *      Fees quoted in `token` count toward the deduction; a nonzero fee quoted in another ERC20 reverts.\n   *\n   *      A zero `targetRouter` uses the source router's enrolled route for `domain`. A nonzero target selects the\n   *      cross-collateral quote and transfer and never falls back to that route. The recipient then receives the\n   *      target router's token, which may differ from `token`, converted by both routers' configured scale ratios.\n   *      Delivery needs the target to accept the source router, as its enrolled route or as a cross-collateral router\n   *      for this origin; otherwise the message stays undelivered, the collateral stays in the source router, and\n   *      nothing refunds it automatically. Explicit targets take ERC20 collateral to a remote domain only: on this\n   *      chain the transfer settles as a synchronous local swap, and a custom ICA configuration would fund an\n   *      interchain account on this same chain, which the ICA flow does not support.\n   *\n   *      Native bridges resolve the spend against the batch's available ETH and forward, as `msg.value`, the route's\n   *      quote for the reduced amount, which covers the delivered amount, fees and gas. Any budget left after that\n   *      quote stays in the batch and returns at closure, and a quote above the budget reverts. `messageFee` is\n   *      ignored. ERC20 bridges grant the Warp Route a temporary approval for the budget and forward `messageFee`\n   *      separately, bounded by the batch's own native. The chain's native ERC20 resolves its spend against the batch\n   *      native remaining after `messageFee`, since the pull and the fee draw from the same balance; a full-pips\n   *      spend therefore leaves the fee funded instead of double-committing it. The token is tracked so any amount\n   *      left in the Metarouter returns with the batch's other unused funds.\n   *\n   *      With a zero `recipient`, funds go to the ICA derived from the destination domain, logical sender, router and\n   *      ISM. An empty ICA configuration uses the enrolled router and ISM, while a custom configuration uses the\n   *      supplied values. This command and every later execution must use the same domain and configuration to reach\n   *      the funded account.\n   *\n   *      A non-zero `recipient` receives the funds directly and skips the interchain account router, so this path also\n   *      works on a lite deployment without one. It cannot fund a destination `EXECUTE_CROSS_CHAIN` plan, rejects a\n   *      custom ICA configuration, must be able to receive the asset on the destination chain, and must not be the\n   *      Metarouter, whose out-of-batch custody is publicly sweepable.\n   *\n   *      An ICA with balance sentinel support can forward its entire native balance with `type(uint256).max`. To spend\n   *      this bridge's output, reveal after the Warp transfer finalizes or begin the destination plan with an unflagged\n   *      `BALANCE_CHECK` on the execution address's native balance. Otherwise the call may forward only an older ICA\n   *      balance and consume the commitment before the bridged funds arrive.\n   * @param _input ABI-encoded `IMetarouter.BridgeTokenParams`.\n   * @param _icaRouter Interchain account router used to derive the destination account.\n   */\n  function bridgeToken(bytes calldata _input, IInterchainAccountRouter _icaRouter) external {\n    IMetarouter.BridgeTokenParams memory _params = abi.decode(_input, (IMetarouter.BridgeTokenParams));\n\n    bytes32 _recipient;\n    if (_params.recipient != address(0)) {\n      // Destination custody outside a batch is publicly sweepable, so the router itself is never a valid target.\n      if (_params.recipient == address(this)) revert IMetarouter.InvalidRecipient();\n      // A custom ICA configuration only exists to derive the account this path does not use.\n      if (_params.icaConfig.router != address(0) || _params.icaConfig.ism != address(0)) {\n        revert IMetarouter.InvalidInterchainAccountConfig();\n      }\n\n      _recipient = _addressToBytes32(_params.recipient);\n    } else {\n      // The derivation path needs the interchain account router; a lite deployment has none.\n      if (address(_icaRouter) == address(0)) revert IMetarouter.CommandDisabled(Commands.BRIDGE_TOKEN);\n\n      bool _usesCustomConfig = _usesCustomIcaConfig(_params.icaConfig);\n      if (!_usesCustomConfig && _icaRouter.routers(_params.domain) == bytes32(0)) {\n        revert IMetarouter.UnregisteredDomain();\n      }\n      bytes32 _userSalt = _addressToBytes32(MetarouterState.msgSender());\n      address _recipientAccount = _usesCustomConfig\n        ? _icaRouter.getRemoteInterchainAccount(\n          address(this), _params.icaConfig.router, _params.icaConfig.ism, _userSalt\n        )\n        : _icaRouter.getRemoteInterchainAccount(_params.domain, address(this), _userSalt);\n      _recipient = _addressToBytes32(_recipientAccount);\n    }\n\n    TokenRouterLib.Route memory _route = TokenRouterLib.Route({\n      sourceToken: _params.token,\n      sourceRouter: _params.bridge,\n      destination: _params.domain,\n      recipient: _recipient,\n      targetRouter: _params.targetRouter\n    });\n    TokenRouterLib.validateTargetRouter(_route);\n\n    // A native bridge funds the fee from the resolved spend, which is already bounded; an ERC20 bridge pays it on top.\n    if (_params.token != address(0)) {\n      if (_params.messageFee > MetarouterState.availableNativeBalance()) {\n        revert IMetarouter.InsufficientBalance(address(0));\n      }\n    }\n\n    TokenRouterLib.validateInputTokenMatches(_route);\n\n    bool _isNative = _params.token == address(0);\n    uint256 _amount;\n    if (_isNative) {\n      _amount = FundsLib.resolveBalance(address(0), MetarouterState.availableNativeBalance(), _params.spend);\n    } else if (_params.token == MetarouterState.nativeErc20()) {\n      // A native ERC20 pull and the message fee draw from the same batch native, so the fee is reserved from that\n      // native before the spend resolves against its native ERC20 decimals conversion.\n      _amount = FundsLib.resolveBalance(\n        _params.token, MetarouterState.availableErc20BalanceAfterMessageFee(_params.messageFee), _params.spend\n      );\n    } else {\n      _amount = FundsLib.resolveSpend(_params.token, _params.spend);\n    }\n    if (_amount == 0) revert IMetarouter.ZeroAmount();\n    uint256 _maxFee;\n    if (_params.maxFee.mode == IMetarouter.SpendMode.Pips) {\n      if (_params.maxFee.value > MAX_PIPS) revert IMetarouter.InvalidPips(_params.maxFee.value);\n      // Rounded up so truncation loosens the bound the caller accepted rather than tightening it.\n      _maxFee = Math.mulDiv(_amount, _params.maxFee.value, MAX_PIPS, Math.Rounding.Ceil);\n    } else {\n      _maxFee = _params.maxFee.value;\n    }\n\n    uint256 _total = TokenRouterLib.quote(_route, _amount);\n    uint256 _fee = _total - _amount;\n    if (_fee > _maxFee) revert IMetarouter.TokenFeeExceedsMax();\n    // Checked before subtracting: an absolute bound does not cap the fee at the amount the way a pip bound does.\n    if (_fee >= _amount) revert IMetarouter.TokenFeeExceedsAmount();\n    uint256 _bridgeAmount = _amount - _fee;\n\n    uint256 _nativeValue;\n    if (_isNative) {\n      // Forward only what the route charges for the reduced amount, so no excess reaches its hook.\n      // Revert if that exceeds the budget, since an underpaid hook may still dispatch an undeliverable message.\n      _nativeValue = TokenRouterLib.quote(_route, _bridgeAmount);\n      if (_nativeValue > _amount) revert IMetarouter.BridgeQuoteExceedsBudget(_nativeValue, _amount);\n    } else {\n      MetarouterState.trackERC20(_params.token);\n      _nativeValue = _params.messageFee;\n    }\n    // This command does not use the bridge message ID.\n    // slither-disable-next-line unused-return\n    TokenRouterLib.transferRemote(_route, _bridgeAmount, _fee, _nativeValue);\n  }\n\n  /**\n   * @notice Dispatches a destination-plan commitment through the logical sender's interchain account.\n   * @dev The reveal service builds the opaque commitment off-chain from the destination plan and a secret.\n   *      `BRIDGE_TOKEN` and this command reach the same ICA only when the destination domain, logical sender, router,\n   *      and ISM match. An empty ICA configuration uses the enrolled router and ISM, while a custom configuration uses\n   *      the supplied values. A zero custom ISM remains part of account derivation and selects Hyperlane's default\n   *      verifier during processing.\n   *\n   *      Hook metadata must include at least the 86-byte standard prefix and refund address field. A nonzero token at\n   *      bytes `[86:106]` selects ERC20 fees; an absent or zero field selects native fees. `tokenFee` caps how much the\n   *      ICA router can pull. Any amount it does not pull remains in the Metarouter and is returned with the batch's\n   *      other unused funds. For the chain's native ERC20 the cap must also fit the batch's native remaining\n   *      after `messageFee` commits, since a native ERC20 pull spends that same native; a larger cap reverts with\n   *      `InsufficientBalance` so a fee pull can never reach the pre-batch balance.\n   *\n   *      ERC20 fees require a deployed ICA router implementing Hyperlane v11.3.1's commit-reveal fee token flow and a\n   *      compatible hook chain. When paying fees in ERC20, `messageFee` must be zero and every fee-charging hook must\n   *      use the metadata token. This library does not validate those conditions, so incompatible combinations revert\n   *      downstream. `messageFee` is bounded by the batch's own native so a dispatch cannot transiently spend what\n   *      the router held before it.\n   * @param _input ABI-encoded `IMetarouter.ExecuteCrosschainParams`.\n   * @param _icaRouter Interchain account router that dispatches the commitment.\n   */\n  function executeCrosschain(bytes calldata _input, IInterchainAccountRouter _icaRouter) external {\n    IMetarouter.ExecuteCrosschainParams memory _params = abi.decode(_input, (IMetarouter.ExecuteCrosschainParams));\n\n    if (_params.messageFee > MetarouterState.availableNativeBalance()) {\n      revert IMetarouter.InsufficientBalance(address(0));\n    }\n\n    bool _usesCustomConfig = _usesCustomIcaConfig(_params.icaConfig);\n    bytes32 _router;\n    if (_usesCustomConfig) {\n      _router = _addressToBytes32(_params.icaConfig.router);\n    } else {\n      _router = _icaRouter.routers(_params.domain);\n      if (_router == bytes32(0)) revert IMetarouter.UnregisteredDomain();\n    }\n    if (_params.hookMetadata.length < _HOOK_METADATA_PREFIX_LENGTH) revert IMetarouter.InvalidHookMetadata();\n    bytes32 _ism = _usesCustomConfig ? _addressToBytes32(_params.icaConfig.ism) : _icaRouter.isms(_params.domain);\n\n    address _token;\n    bytes memory _hookMetadata = _params.hookMetadata;\n    if (_hookMetadata.length >= _HOOK_METADATA_PREFIX_LENGTH + 20) {\n      assembly ('memory-safe') {\n        // Skip the length word, seek the field, then drop the 12 trailing bytes the word overshoots into.\n        _token := shr(96, mload(add(add(_hookMetadata, 0x20), _HOOK_METADATA_PREFIX_LENGTH)))\n      }\n    }\n    if (_token != address(0)) {\n      // A native ERC20 fee pull spends the same native the message fee commits below, so the grant must fit the\n      // batch native remaining after that fee, converted to the native ERC20's decimals. Other tokens need no check: a\n      // pull beyond the balance reverts inside the token.\n      if (\n        _token == MetarouterState.nativeErc20()\n          && _params.tokenFee > MetarouterState.availableErc20BalanceAfterMessageFee(_params.messageFee)\n      ) {\n        revert IMetarouter.InsufficientBalance(_token);\n      }\n      MetarouterState.trackERC20(_token);\n      IERC20(_token).forceApprove(address(_icaRouter), _params.tokenFee);\n    }\n\n    // slither-disable-next-line arbitrary-send-eth,unused-return\n    _icaRouter.callRemoteCommitReveal{value: _params.messageFee}(\n      _params.domain,\n      _router,\n      _ism,\n      _params.hookMetadata,\n      _params.hook,\n      _addressToBytes32(MetarouterState.msgSender()),\n      _params.commitment\n    );\n\n    if (_token != address(0)) IERC20(_token).forceApprove(address(_icaRouter), 0);\n  }\n\n  /**\n   * @notice Burns held `ReceiptToken` through the leaf Voter, dispatching the message that mints `TOKEN` to the\n   *         recipient on root.\n   * @dev The voter burns the receipt from this router, so no approval is needed. `messageFee` is bounded by the\n   *      batch's own native so a redeem cannot transiently spend what the router held before it. Nothing on the leaf\n   *      quotes or checks the fee beyond that bound, so an underfunded `messageFee` reverts inside the transport. A\n   *      zero `refundRecipient` resolves to this router here, since the transport rejects a zero refund address once\n   *      it has an overpayment to return.\n   * @param _input ABI-encoded `IMetarouter.RedeemParams`.\n   * @param _leafVoter Leaf Voter that burns the receipt and dispatches the message.\n   * @param _receiptToken `ReceiptToken` the leaf Voter burns, this deployment's emission token.\n   */\n  function redeem(bytes calldata _input, ILeafVoter _leafVoter, IERC20 _receiptToken) external {\n    IMetarouter.RedeemParams memory _params = abi.decode(_input, (IMetarouter.RedeemParams));\n\n    if (_params.recipient == address(this)) revert IMetarouter.InvalidRecipient();\n    if (_params.messageFee > MetarouterState.availableNativeBalance()) {\n      revert IMetarouter.InsufficientBalance(address(0));\n    }\n\n    uint256 _amount = FundsLib.fund(address(_receiptToken), _params.spend, _params.payerIsUser);\n\n    address _refundRecipient = _params.refundRecipient == address(0) ? address(this) : _params.refundRecipient;\n\n    // The voter rejects a zero recipient and an amount below `MIN_REDEEM_AMOUNT`, which covers a zero amount too.\n    // slither-disable-next-line arbitrary-send-eth\n    _leafVoter.redeem{value: _params.messageFee}(_amount, _params.recipient, _params.gasLimit, _refundRecipient);\n  }\n\n  /**\n   * @notice Returns whether a command supplies a custom destination ICA configuration.\n   * @dev The all-zero configuration is the default sentinel. Once a custom router is supplied, the ISM may remain\n   *      zero intentionally; an ISM without a router is rejected so zero-router inputs cannot be interpreted two ways.\n   * @param _icaConfig Optional custom destination ICA router and ISM.\n   * @return _usesCustom Whether the command supplied a custom destination router.\n   */\n  function _usesCustomIcaConfig(IMetarouter.IcaConfig memory _icaConfig) private pure returns (bool _usesCustom) {\n    if (_icaConfig.router != address(0)) return true;\n    if (_icaConfig.ism != address(0)) revert IMetarouter.InvalidInterchainAccountConfig();\n    return false;\n  }\n\n  /**\n   * @notice Left-pads an address into a bytes32 word.\n   * @param _account Address to convert.\n   * @return _word The address in the low 20 bytes of a bytes32.\n   */\n  function _addressToBytes32(address _account) private pure returns (bytes32 _word) {\n    return bytes32(uint256(uint160(_account)));\n  }\n}\n"},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport {SafeCast} from '@openzeppelin/contracts/utils/math/SafeCast.sol';\n\nimport {FundsLib} from 'V3/metarouter/libraries/FundsLib.sol';\nimport {MetarouterState} from 'V3/metarouter/libraries/MetarouterState.sol';\n\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\nimport {IRelay} from 'V3/interfaces/relay/IRelay.sol';\nimport {IRelayFactory} from 'V3/interfaces/relay/IRelayFactory.sol';\nimport {IRelayFactoryRegistry} from 'V3/interfaces/relay/IRelayFactoryRegistry.sol';\nimport {IRelayState} from 'V3/interfaces/relay/IRelayState.sol';\n\n/**\n * @title StakeRelayLib\n * @notice sAERO-creation and relay-deposit command handlers for the Metarouter.\n * @dev Deployed as a standalone library; the router calls each handler through `DELEGATECALL`, so the code lives\n *      outside the router's bytecode but runs in its storage context. Custody tracking, sender resolution, and funding\n *      go through `MetarouterState` / `FundsLib`; the VotingEscrow and its staking token are passed in because a\n *      library cannot read the router's immutables.\n *\n *      `CREATE_STAKE` and `DEPOSIT_RELAY` are root-only: the VotingEscrow and the relays exist only on the root\n *      deployment, so the router gates both on `IS_ROOT` before dispatch and these handlers receive a non-zero escrow.\n */\nlibrary StakeRelayLib {\n  using SafeERC20 for IERC20;\n  using SafeCast for uint256;\n\n  /**\n   * @notice Stakes the staking token into a freshly minted sAERO, retaining it in flight or delivering it.\n   * @dev Funds the staking token through `FundsLib.fund` (from the batch balance or the logical sender), approves the\n   *      escrow for that amount, and calls `createStake`, which pulls the amount and mints the sAERO to the router.\n   *      A recipient equal to the router leaves the new sAERO in flight so a later command can consume its otherwise\n   *      unknowable token id; any other non-zero recipient receives it immediately.\n   * @param _input ABI-encoded `(BalanceSpend spend, bool payerIsUser, uint48 stakingWeeks, bool isPermanent, address\n   *        recipient)`, where the router address retains the new sAERO in flight.\n   * @param _escrow VotingEscrow the stake is created through; non-zero, the router gates the command on `IS_ROOT`.\n   * @param _stakingToken Token the escrow stakes, funded and approved before the stake.\n   */\n  function createStake(bytes calldata _input, IVotingEscrow _escrow, IERC20 _stakingToken) external {\n    (\n      IMetarouter.BalanceSpend memory _spend,\n      bool _payerIsUser,\n      uint48 _stakingWeeks,\n      bool _isPermanent,\n      address _recipient\n    ) = abi.decode(_input, (IMetarouter.BalanceSpend, bool, uint48, bool, address));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n\n    // The downcast runs before the approve so an over-width amount fails before any effect.\n    uint128 _amount = FundsLib.fund(address(_stakingToken), _spend, _payerIsUser).toUint128();\n    // `createStake` pulls exactly `_amount`, so success consumes the allowance in full and no reset is needed.\n    _stakingToken.forceApprove(address(_escrow), _amount);\n    uint256 _tokenId = _escrow.createStake(_amount, _stakingWeeks, _isPermanent);\n\n    if (_recipient == address(this)) {\n      // The escrow mints directly to the router without invoking its receiver hook. Track the new sAERO and publish\n      // its otherwise unknowable id so a later command in this batch can resolve the zero sentinel.\n      MetarouterState.trackNft(address(_escrow), _tokenId);\n      MetarouterState.setInFlightNft(address(_escrow), _tokenId);\n    } else {\n      IERC721(address(_escrow)).safeTransferFrom(address(this), _recipient, _tokenId);\n    }\n  }\n\n  /**\n   * @notice Deposits an existing or in-flight sAERO into a caller-selected relay for the selected share recipient.\n   * @dev Pass-through custody: a zero token id resolves the in-flight sAERO; otherwise the router uses an sAERO already\n   *      in this batch's custody or pulls the logical sender's token with `transferFrom` (its receiver hook accepts\n   *      only a delivery the active command solicited). It requests the deposit for the selected share recipient,\n   *      returns the source sAERO to the logical sender, and consumes the in-flight reference when that was the source.\n   *\n   *      The relay is caller-supplied, so it is authenticated before any approval is granted: a spoofed relay could\n   *      otherwise report an authorized VPM and route the caller's weight to an attacker-chosen destination. The relay\n   *      names its factory, the RelayFactoryRegistry must approve that factory, and the factory must have created the\n   *      relay. The registry check alone would not do, since a spoofed relay can name any approved factory. A relay\n   *      that cannot answer the factory read reverts on its own; the caller picked it and can pick another.\n   *      The deposit moves weight through the relay's VoterPaymentsModule, so the relay and that VPM must\n   *      both be ERC721-authorized on the token at once. The single token-scoped approval goes to the caller-selected\n   *      relay (cleared when the sAERO returns); the operator grant goes to the VPM, which the escrow vouches for\n   *      through `isAuthorizedVPM` and which is revoked after the deposit.\n   *\n   *      Transferring the sAERO to the router clears the user's approval for that token. To deposit from the same\n   *      sAERO more than once in a batch, approve the router with `setApprovalForAll`. Otherwise, approve the token\n   *      again before each separate deposit transaction.\n   *\n   *      Caller preconditions, surfaced as relay-side reverts: the sAERO needs at least `_amount` of idle chain0\n   *      weight (set by a prior vote outside the router), and a permissioned relay must have allow-listed the router\n   *      and selected recipient. The custody round-trip also clears the sAERO's delegation and blocks same-block\n   *      re-delegation (escrow transfers checkpoint the delegator), so delegators must re-delegate after.\n   * @param _input ABI-encoded `(uint256 tokenId, uint256 amount, address relay, address recipient)`, where token id zero\n   *        uses the in-flight sAERO.\n   * @param _escrow VotingEscrow the sAERO belongs to; non-zero, the router gates the command on `IS_ROOT`.\n   * @param _relayFactoryRegistry RelayFactoryRegistry the caller-selected relay's factory is authenticated against;\n   *        non-zero on root.\n   */\n  function depositRelay(\n    bytes calldata _input,\n    IVotingEscrow _escrow,\n    IRelayFactoryRegistry _relayFactoryRegistry\n  ) external {\n    (uint256 _tokenId, uint256 _amount, address _relay, address _recipient) =\n      abi.decode(_input, (uint256, uint256, address, address));\n    if (_recipient == address(0)) revert IMetarouter.InvalidRecipient();\n    // Shares mint at keeper settlement, outside any batch, so a router recipient would leave them untracked on the\n    // execution address where the permissionless `SWEEP` takes them.\n    if (_recipient == address(this)) revert IMetarouter.InvalidRecipient();\n\n    // Authenticate the caller-selected relay before trusting anything it reports: a spoofed relay could otherwise name\n    // an authorized VPM and route the caller's weight to an attacker-chosen destination. The reported factory must be\n    // approved and must itself vouch for the relay, since a spoofed relay can name any approved factory.\n    address _relayFactory = IRelayState(_relay).factory();\n    if (!_relayFactoryRegistry.isRelayFactoryApproved(_relayFactory) || !IRelayFactory(_relayFactory).isRelay(_relay)) {\n      revert IMetarouter.UnauthorizedRelay();\n    }\n\n    // Vet the relay's VoterPaymentsModule before taking custody: the operator grant below goes to this address.\n    address _vpm = address(IRelay(_relay).vpm());\n    if (!_escrow.isAuthorizedVPM(_vpm)) revert IMetarouter.UnauthorizedRelayVpm();\n\n    _tokenId = MetarouterState.resolvePositionId(address(_escrow), _tokenId);\n    address _owner = MetarouterState.msgSender();\n    // A position the router currently owns must have entered custody during this batch. A tracked position may have\n    // been returned by an earlier command, so reacquire it from the logical sender whenever ownership has moved out.\n    if (_escrow.ownerOf(_tokenId) == address(this)) {\n      if (!MetarouterState.isNftInCustody(address(_escrow), _tokenId)) revert IMetarouter.NftNotInCustody();\n    } else {\n      // slither-disable-next-line arbitrary-send-erc20\n      _escrow.transferFrom(_owner, address(this), _tokenId);\n    }\n\n    _escrow.setApprovalForAll(_vpm, true);\n    _escrow.approve(_relay, _tokenId);\n\n    // The selected recipient receives the shares at settlement regardless of who holds the source sAERO then.\n    IRelay(_relay).requestDeposit(_tokenId, _amount, _recipient);\n\n    // Revoke the operator grant, return the source sAERO to the logical sender, and consume an in-flight reference.\n    _escrow.setApprovalForAll(_vpm, false);\n    _escrow.transferFrom(address(this), _owner, _tokenId);\n    MetarouterState.consumeInFlightNft(address(_escrow), _tokenId);\n  }\n}\n"},"V3/src/interfaces/vpm/IVoterPaymentsModule.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\nimport {IGuardedAccessControlEnumerable} from 'V3/interfaces/access/IGuardedAccessControlEnumerable.sol';\nimport {IVotingEscrow} from 'V3/interfaces/core/IVotingEscrow.sol';\n\n/// @title VoterPaymentsModule interface\n/// @notice Full surface of a VoterPaymentsModule: the user-facing operations VotingEscrow gates on, plus the fee map,\n///         restricted map, role management, and admin entry points. Implementations advertise this interface via\n///         ERC-165 and are granted VPM_ROLE on the VotingEscrow to be authorized.\ninterface IVoterPaymentsModule is IERC165, IGuardedAccessControlEnumerable {\n  /*//////////////////////////////////////////////////////////////\n                                 STRUCTS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Dependencies and initial fee-management role holders.\n  /// @param votingEscrow Voting escrow mediated by the module, which may be a predicted address.\n  /// @param feeManagerAdmin Address granted FEE_MANAGER_ADMIN_ROLE.\n  /// @param feeManager Address granted FEE_MANAGER.\n  struct ConstructorParams {\n    address votingEscrow;\n    address feeManagerAdmin;\n    address feeManager;\n  }\n\n  /// @notice Per-caller fee record for a given operation signature.\n  /// @param registered Always true for a written record; distinguishes a stored entry from an absent (zero) one.\n  /// @param rateInPips Caller's rate in pips. Honored only when `registered` is true and the value is\n  ///                   below the default rate stored at `fees[sig][address(0)]`.\n  struct CallerInfo {\n    bool registered;\n    uint128 rateInPips;\n  }\n\n  /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Emitted at the end of `depositIntoNFT`.\n  /// @param caller Address that invoked the operation.\n  /// @param sources Source deltas submitted to VE.\n  /// @param destinationId Resolved destination token id (mint sentinels replaced by the assigned id).\n  /// @param totalIn Sum of source amounts before fee.\n  /// @param fee Amount routed to the protocol accumulator.\n  event DepositedIntoNFT(\n    address indexed caller,\n    IVotingEscrow.SourceDelta[] sources,\n    uint256 indexed destinationId,\n    uint256 totalIn,\n    uint256 fee\n  );\n\n  /// @notice Emitted at the end of `withdrawToNFT`.\n  /// @param caller Address that invoked the operation.\n  /// @param sourceId Source token id whose stake was reduced.\n  /// @param destinations Destination deltas as supplied by the caller (before fee trim).\n  /// @param totalOut Sum of caller-supplied destination amounts.\n  /// @param fee Amount routed to the protocol accumulator.\n  event WithdrawnToNFT(\n    address indexed caller,\n    uint256 indexed sourceId,\n    IVotingEscrow.DestinationDelta[] destinations,\n    uint256 totalOut,\n    uint256 fee\n  );\n\n  /// @notice Emitted whenever a fee record is written via `setFee`.\n  /// @param sig Operation selector that the entry applies to.\n  /// @param caller Address whose record was updated. address(0) is the default slot.\n  /// @param info Stored CallerInfo built from the supplied rate; `registered` is always true for a written record.\n  event FeeSet(bytes4 indexed sig, address indexed caller, CallerInfo info);\n\n  /// @notice Emitted when a caller's fee record is cleared via `removeFee`.\n  /// @param sig Operation selector whose record was cleared.\n  /// @param caller Address whose record was removed.\n  event FeeRemoved(bytes4 indexed sig, address indexed caller);\n\n  /// @notice Emitted whenever the restricted mode of an operation is toggled via `setRestricted`.\n  /// @param sig Operation selector that was toggled.\n  /// @param value New value of the restricted flag.\n  event RestrictedSet(bytes4 indexed sig, bool value);\n\n  /*//////////////////////////////////////////////////////////////\n                                 ERRORS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Thrown when a constructor argument is the zero address.\n  error ZeroAddress();\n\n  /// @notice Thrown when the caller is not authorized over a source tokenId.\n  /// @param tokenId Token id whose authorization check failed.\n  error NotApprovedByOwner(uint256 tokenId);\n\n  /// @notice Thrown when `depositIntoNFT` is called with an empty sources array.\n  error NoSources();\n\n  /// @notice Thrown when `withdrawToNFT` is called with an empty destinations array.\n  error NoDestinations();\n\n  /// @notice Thrown when `withdrawToNFT` is called with destination amounts summing to zero.\n  error ZeroWithdraw();\n\n  /// @notice Thrown when `withdrawToNFT` has a nonzero total but every destination trims to zero.\n  error AllDestinationsTrimmedToZero();\n\n  /// @notice Thrown when `setFee` is called with a rate higher than `MAX_PIPS` (100%).\n  error InvalidFeeRate();\n\n  /// @notice Thrown when an operation is restricted and the caller is not registered.\n  error NotRegistered();\n\n  /// @notice Thrown when `removeFee` targets the default slot (address(0)), which is managed only via `setFee`.\n  error CannotRemoveDefault();\n\n  /// @notice Thrown when a `depositIntoNFT` mint-sentinel destination would mint a zero-stake NFT.\n  error ZeroMintAmount();\n\n  /*//////////////////////////////////////////////////////////////\n                       USER-FACING OPERATIONS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Move staking weight from one or more source sAEROs into a destination sAERO.\n  /// @dev A zero-amount source is skipped on the Voter chain0 mirror, but VE still folds its unlock into the\n  ///      source-end check: a zero-amount permanent source forces `type(uint48).max` and reverts `UnlockTimeReduction`\n  ///      against any non-permanent destination, so it is not a universal no-op.\n  /// @dev Every source must have voted at least once and hold at least its delta amount idle on chain0,\n  ///      or the Voter reverts `InsufficientChain0Allocation`. Vote or reset the source first.\n  /// @param _sources Per-source deltas describing the amount taken from each source tokenId.\n  /// @param _destinationId Destination tokenId, or type(uint256).max to mint a fresh sAERO to _recipient.\n  /// @param _recipient Owner of the freshly minted sAERO when _destinationId is the mint sentinel; ignored otherwise.\n  /// @return _mintedIds Token ids assigned by VE for each mint sentinel resolved during the call.\n  function depositIntoNFT(\n    IVotingEscrow.SourceDelta[] calldata _sources,\n    uint256 _destinationId,\n    address _recipient\n  ) external returns (uint256[] memory _mintedIds);\n\n  /// @notice Move staking weight from a single source sAERO into one or more destinations.\n  /// @dev The source must have voted at least once and hold at least the total withdrawn amount idle on\n  ///      chain0, or the Voter reverts `InsufficientChain0Allocation`. Vote or reset the source first.\n  /// @dev A destination equal to the source is not rejected: its source and destination legs net out on both VE\n  ///      and the Voter's chain0 ledger, leaving only the fee leg as a real move; a trim that rounds to zero is a\n  ///      no-op whose amount falls into the fee leg. Either way the caller burns gas (and the fee) for no net change.\n  /// @dev Only a mint leg (`tokenId == type(uint256).max`) may carry a nonzero `recipient`; every other destination\n  ///      must leave it zero, or the call reverts `IVotingEscrow.NonMintRecipientNotAllowed`. This keeps the emitted\n  ///      `WithdrawnToNFT` destinations canonical, mirroring the guard `rebalanceUnderlying` already enforces.\n  /// @param _sourceId Source tokenId from which weight is removed.\n  /// @param _destinations Per-destination deltas, including any caller-supplied accumulator entries.\n  /// @return _mintedIds Token ids assigned by VE for each mint sentinel resolved during the call.\n  function withdrawToNFT(\n    uint256 _sourceId,\n    IVotingEscrow.DestinationDelta[] calldata _destinations\n  ) external returns (uint256[] memory _mintedIds);\n\n  /*//////////////////////////////////////////////////////////////\n                            FEE / ROLE ADMIN\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Write a fee record for an operation.\n  /// @dev Stores `{registered: true, rateInPips: _rateInPips}`; reverts `InvalidFeeRate` when `_rateInPips > MAX_PIPS`.\n  /// @param _sig Operation selector that the record applies to.\n  /// @param _caller Caller address whose record is updated. address(0) targets the operation default.\n  /// @param _rateInPips Rate in pips to store for the caller.\n  function setFee(bytes4 _sig, address _caller, uint128 _rateInPips) external;\n\n  /// @notice Toggle whether unregistered callers can initiate an operation.\n  /// @param _sig Operation selector whose restricted flag is updated.\n  /// @param _value New value of the flag.\n  function setRestricted(bytes4 _sig, bool _value) external;\n\n  /// @notice Clear a caller's fee record for an operation, dropping the caller back to the default rate.\n  /// @dev Fee-override cleanup only, not an access lever. Reverts `CannotRemoveDefault` for the default\n  ///      slot (address(0)) and `NotRegistered` when there is no record; succeeds regardless of the\n  ///      operation's restricted flag.\n  /// @param _sig Operation selector whose record is cleared.\n  /// @param _caller Caller address whose record is removed.\n  function removeFee(bytes4 _sig, address _caller) external;\n\n  /*//////////////////////////////////////////////////////////////\n                                CONSTANTS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Role required to write the fee map and toggle restricted mode.\n  function FEE_MANAGER() external view returns (bytes32 _role);\n\n  /// @notice Role-admin for FEE_MANAGER.\n  function FEE_MANAGER_ADMIN_ROLE() external view returns (bytes32 _role);\n\n  /// @notice VE tokenId of the protocol-owned accumulator that collects fees on the chain0 ledger.\n  function FEE_ACCUMULATOR_ID() external view returns (uint256 _tokenId);\n\n  /*//////////////////////////////////////////////////////////////\n                               IMMUTABLES\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Voting escrow this VPM mediates.\n  function VOTING_ESCROW() external view returns (IVotingEscrow _votingEscrow);\n\n  /*//////////////////////////////////////////////////////////////\n                              STATE GETTERS\n  //////////////////////////////////////////////////////////////*/\n\n  /// @notice Per-operation, per-caller fee record.\n  /// @param _sig Operation selector.\n  /// @param _caller Caller address. address(0) is the default slot.\n  /// @return _registered True if the caller has a stored record.\n  /// @return _rateInPips Caller's stored rate.\n  function fees(bytes4 _sig, address _caller) external view returns (bool _registered, uint128 _rateInPips);\n\n  /// @notice Per-operation restricted flag. When true, only registered callers can initiate the operation.\n  /// @param _sig Operation selector.\n  /// @return _restricted Current value of the flag.\n  function restricted(bytes4 _sig) external view returns (bool _restricted);\n\n  /// @notice Resolve the effective rate a caller would pay for an operation.\n  /// @dev Reverts with NotRegistered when the operation is restricted and the caller is not registered.\n  /// @param _sig Operation selector.\n  /// @param _caller Caller address.\n  /// @return _rateInPips Effective rate the caller would be charged.\n  function getFee(bytes4 _sig, address _caller) external view returns (uint128 _rateInPips);\n}\n"},"V3/src/metarouter/libraries/TokenRouterLib.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\n\nimport {ICrossCollateralTokenRouter} from 'V3/interfaces/external/ICrossCollateralTokenRouter.sol';\nimport {ITokenRouter} from 'V3/interfaces/external/ITokenRouter.sol';\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title TokenRouterLib\n * @notice Stateless adapter for default and explicitly targeted Hyperlane token routers.\n * @dev These internal functions use the calling contract's balances and allowances. Bridge calls originate from\n *      that contract. The caller checks available funds, chooses the recipient and fee limits, and refunds unused\n *      funds. This library does not derive an ICA or read Metarouter state.\n */\nlibrary TokenRouterLib {\n  using SafeERC20 for IERC20;\n\n  /**\n   * @notice A resolved asset route and its final beneficiary.\n   * @param sourceToken Source ERC20, or zero for native collateral through the default API.\n   * @param sourceRouter Source token router holding or burning the asset.\n   * @param destination Destination Hyperlane domain, independent of the EVM chain id.\n   * @param recipient Final beneficiary encoded into the token message.\n   * @param targetRouter Explicit destination token router, or zero to use the source router's enrolled route for\n   *        the destination domain.\n   */\n  struct Route {\n    address sourceToken;\n    address sourceRouter;\n    uint32 destination;\n    bytes32 recipient;\n    bytes32 targetRouter;\n  }\n\n  /**\n   * @notice Sends a validated transfer with a bounded temporary ERC20 approval and clears that approval afterward.\n   * @dev The caller validates the route and checks that principal plus token fees and the native value fit its\n   *      available balances. If the ERC20 spends the same balance as native currency, their combined spend must\n   *      fit that balance. ERC20 approval equals principal plus the authorized token fee; the bridge calculates\n   *      its actual fee during transfer. Native routes grant no approval and ignore `_tokenFee`. A failed transfer\n   *      propagates its revert and rolls back approval changes.\n   * @param _route Validated asset route and resolved beneficiary.\n   * @param _tokenAmount Source-token principal passed to the selected transfer API before destination scaling.\n   * @param _tokenFee Fees authorized in the source ERC20 in addition to principal; unused for native collateral.\n   * @param _nativeValue Native currency forwarded: the route's quote for the principal for native token routes, or\n   *        the message fee for ERC20 routes.\n   * @return _messageId Hyperlane message identifier returned by the selected token router.\n   */\n  function transferRemote(\n    Route memory _route,\n    uint256 _tokenAmount,\n    uint256 _tokenFee,\n    uint256 _nativeValue\n  ) internal returns (bytes32 _messageId) {\n    if (_route.sourceToken != address(0)) {\n      IERC20(_route.sourceToken).forceApprove(_route.sourceRouter, _tokenAmount + _tokenFee);\n    }\n    _messageId = _dispatch(_route, _tokenAmount, _nativeValue);\n    if (_route.sourceToken != address(0)) IERC20(_route.sourceToken).forceApprove(_route.sourceRouter, 0);\n  }\n\n  /**\n   * @notice Rejects explicit targets for the zero-address native token or the source router's own domain.\n   * @dev Default routes skip these checks and never read `localDomain`. The source CCR enforces target enrollment\n   *      during transfer. The target is the destination token router, not the beneficiary or ICA router.\n   * @param _route Asset route whose explicit mode is being validated.\n   */\n  function validateTargetRouter(Route memory _route) internal view {\n    // The default route for the destination domain needs no explicit-target validation.\n    if (_route.targetRouter == bytes32(0)) return;\n    if (_route.sourceToken == address(0)) revert IMetarouter.UnsupportedCrossCollateralToken();\n    if (ICrossCollateralTokenRouter(_route.sourceRouter).localDomain() == _route.destination) {\n      revert IMetarouter.SameDomainCrossCollateralTransfer();\n    }\n  }\n\n  /**\n   * @notice Requires the source router to report the asset the caller intends to transfer.\n   * @dev This compatibility check does not authenticate a caller-selected router or certify its delivery behavior.\n   * @param _route Asset route whose source-token identity is being validated.\n   */\n  function validateInputTokenMatches(Route memory _route) internal view {\n    if (ITokenRouter(_route.sourceRouter).token() != _route.sourceToken) revert IMetarouter.BridgeTokenMismatch();\n  }\n\n  /**\n   * @notice Quotes the selected route and returns the source-token amount it requires.\n   * @dev Sums every entry in `sourceToken` and rejects nonzero entries in other ERC20 tokens. On ERC20 routes, native\n   *      entries are skipped: the quote prices the budget while dispatch sends the smaller principal, so the native\n   *      value forwarded with the transfer is checked by the bridge instead.\n   * @param _route Asset route and final beneficiary used for both quoting and dispatch.\n   * @param _amount Source-token transfer amount being quoted.\n   * @return _total Total source-token amount required by the quote, including the transfer amount and token fees.\n   */\n  function quote(Route memory _route, uint256 _amount) internal view returns (uint256 _total) {\n    ITokenRouter.Quote[] memory _quotes = _route.targetRouter == bytes32(0)\n      ? ITokenRouter(_route.sourceRouter).quoteTransferRemote(_route.destination, _route.recipient, _amount)\n      : ICrossCollateralTokenRouter(_route.sourceRouter)\n        .quoteTransferRemoteTo(_route.destination, _route.recipient, _amount, _route.targetRouter);\n\n    uint256 _length = _quotes.length;\n    for (uint256 _i; _i < _length; ++_i) {\n      ITokenRouter.Quote memory _quote = _quotes[_i];\n      if (_quote.token == _route.sourceToken) {\n        _total += _quote.amount;\n      } else if (_quote.token != address(0)) {\n        if (_quote.amount != 0) revert IMetarouter.UnsupportedBridgeFeeToken(_quote.token);\n      }\n    }\n    if (_total < _amount) revert IMetarouter.InvalidBridgeQuote();\n  }\n\n  /**\n   * @notice Calls exactly the API selected for the route, without substituting a default route on failure.\n   * @param _route Asset route and resolved beneficiary.\n   * @param _tokenAmount Source-token amount passed to the router.\n   * @param _nativeValue Caller-authorized native value forwarded with the transfer.\n   * @return _messageId Identifier returned by the selected transfer API.\n   */\n  function _dispatch(\n    Route memory _route,\n    uint256 _tokenAmount,\n    uint256 _nativeValue\n  ) private returns (bytes32 _messageId) {\n    if (_route.targetRouter == bytes32(0)) {\n      // slither-disable-next-line arbitrary-send-eth\n      return ITokenRouter(_route.sourceRouter).transferRemote{value: _nativeValue}(\n        _route.destination, _route.recipient, _tokenAmount\n      );\n    }\n\n    // slither-disable-next-line arbitrary-send-eth\n    return ICrossCollateralTokenRouter(_route.sourceRouter).transferRemoteTo{value: _nativeValue}(\n      _route.destination, _route.recipient, _tokenAmount, _route.targetRouter\n    );\n  }\n}\n"},"V3/src/interfaces/factories/ICLGaugeFactory.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title ICLGaugeFactory\n/// @notice Concentrated-liquidity gauge factory functions used by the Metarouter's position manager resolution.\ninterface ICLGaugeFactory {\n  /// @notice Address of the NonfungiblePositionManager used to create nfts that gauges will accept\n  /// @dev Immutable and nonzero upstream, set to the manager of the CL factory the gauge factory serves. Returned as\n  ///      an `address` to mirror the upstream ABI and keep this interface free of a position-manager import.\n  /// @return The nonfungible position manager the factory's gauges accept.\n  function nft() external view returns (address);\n}\n"},"V3/src/metarouter/libraries/MetarouterState.sol":{"content":"// SPDX-License-Identifier: LicenseRef-Dromos-Restricted-Use-1.0\npragma solidity 0.8.36;\n\nimport {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\n\nimport {TransientTracking} from 'V3/metarouter/TransientTracking.sol';\n\nimport {IMetarouter} from 'V3/interfaces/metarouter/IMetarouter.sol';\n\n/**\n * @title MetarouterState\n * @notice Namespaced transient-storage slots and the accessors over them, shared by the Metarouter and its\n *         command libraries.\n * @dev The command libraries run via `DELEGATECALL` in the router's storage context, so both the router and the\n *      libraries must reference the exact same slots. Keeping the constants and their accessors here is the single\n *      source of truth that prevents the two from drifting. The accessors re-express the router's former custody\n *      virtuals (`_track`/`_msgSender`/`_availableNativeBalance`) as slot reads through `TransientTracking`.\n */\nlibrary MetarouterState {\n  /**\n   * @notice Original caller of the active outer batch, which doubles as the batch-active flag.\n   * @dev Set to the outer caller when a batch opens and cleared on close. Because the opener's `msg.sender` can never\n   *      be `address(0)` on-chain, a non-zero locker is an exact proxy for \"a batch is active\", so no separate active\n   *      flag is stored.\n   * @return The locker slot.\n   */\n  bytes32 public constant LOCKER_SLOT = keccak256('dromos.metarouter.execution.locker');\n\n  /**\n   * @notice Native balance held before the outer batch, excluding its `msg.value`.\n   * @return The pre-batch native-balance slot.\n   */\n  bytes32 public constant NATIVE_BALANCE_BEFORE_SLOT = keccak256('dromos.metarouter.execution.native.before');\n\n  /**\n   * @notice ERC20 entry point of the chain's native asset, published by the router when a batch opens.\n   * @dev The command libraries run via `DELEGATECALL` and cannot read the router's `NATIVE_ERC20` immutable, so the\n   *      batch opening copies it here for `availableErc20Balance`. Zero on a chain whose native asset has no ERC20\n   *      entry point, where no token ever matches it.\n   * @return The native ERC20 slot.\n   */\n  bytes32 public constant NATIVE_ERC20_SLOT = keccak256('dromos.metarouter.execution.nativeErc20');\n\n  /**\n   * @notice Native value in wei represented by one raw unit of the native ERC20, published by the router when a batch opens.\n   * @dev Copied from the router's `NATIVE_ERC20_SCALE` immutable alongside the native ERC20 token, so the decimal conversions\n   *      in `availableErc20Balance` and `availableErc20BalanceAfterMessageFee` are reachable via `DELEGATECALL`. Written\n   *      only when a native ERC20 exists, so it is never read while zero.\n   * @return The native-native ERC20 scale slot.\n   */\n  bytes32 public constant NATIVE_ERC20_SCALE_SLOT = keccak256('dromos.metarouter.execution.nativeErc20Scale');\n\n  /**\n   * @notice CL pool currently authorized to invoke the swap callback.\n   * @return The expected-callback-caller slot.\n   */\n  bytes32 public constant EXPECTED_CALLBACK_CALLER_SLOT = keccak256('dromos.metarouter.callback.caller');\n\n  /**\n   * @notice Deduplication flags for ERC20s brought into custody during the active batch.\n   * @return The tracked-flag namespace slot.\n   */\n  bytes32 public constant TRACKED_SLOT = keccak256('dromos.metarouter.sweep.token.tracked');\n\n  /**\n   * @notice Length-prefixed array of ERC20s brought into custody during the active batch.\n   * @return The tracked-array slot.\n   */\n  bytes32 public constant ERC20_ARRAY_SLOT = keccak256('dromos.metarouter.sweep.token.array');\n\n  /**\n   * @notice Length-prefixed array of NFT collections brought into custody during the active batch, index-aligned\n   *         with `NFT_TOKEN_ID_ARRAY_SLOT`.\n   * @return The tracked NFT-collection array slot.\n   */\n  bytes32 public constant NFT_COLLECTION_ARRAY_SLOT = keccak256('dromos.metarouter.nft.collection.array');\n\n  /**\n   * @notice Length-prefixed array of NFT token IDs brought into custody during the active batch, index-aligned with\n   *         `NFT_COLLECTION_ARRAY_SLOT`.\n   * @return The tracked NFT-token-id array slot.\n   */\n  bytes32 public constant NFT_TOKEN_ID_ARRAY_SLOT = keccak256('dromos.metarouter.nft.tokenId.array');\n\n  /**\n   * @notice Namespace seed for an NFT's deduplication-flag slot,\n   *         `keccak256(abi.encode(collection, tokenId, NFT_TRACKED_SLOT))`.\n   * @return The tracked NFT-flag namespace seed.\n   */\n  bytes32 public constant NFT_TRACKED_SLOT = keccak256('dromos.metarouter.nft.tracked');\n\n  /**\n   * @notice Collection of the single NFT a producer command left for a later command to consume, or zero when none is\n   *         in flight; paired with `IN_FLIGHT_TOKEN_ID_SLOT`.\n   * @return The in-flight NFT-collection slot.\n   */\n  bytes32 public constant IN_FLIGHT_COLLECTION_SLOT = keccak256('dromos.metarouter.inflight.collection');\n\n  /**\n   * @notice Token id of the single in-flight NFT, paired with `IN_FLIGHT_COLLECTION_SLOT`.\n   * @return The in-flight NFT-token-id slot.\n   */\n  bytes32 public constant IN_FLIGHT_TOKEN_ID_SLOT = keccak256('dromos.metarouter.inflight.tokenId');\n\n  /**\n   * @notice Collection the router currently expects an inbound position from, published for `onERC721Received`, which\n   *         runs in its own call frame and so cannot read the resolving command's manager; paired with\n   *         `EXPECTED_NFT_SENDER_SLOT`.\n   * @return The expected-NFT-collection slot.\n   */\n  bytes32 public constant EXPECTED_NFT_COLLECTION_SLOT = keccak256('dromos.metarouter.nft.expectedCollection');\n\n  /**\n   * @notice Sender the router currently expects an inbound position from, set only around the external call that\n   *         returns one, or zero when the router solicited none; paired with `EXPECTED_NFT_TOKEN_ID_SLOT`.\n   * @return The expected-NFT-sender slot.\n   */\n  bytes32 public constant EXPECTED_NFT_SENDER_SLOT = keccak256('dromos.metarouter.nft.expectedSender');\n\n  /**\n   * @notice Position the router currently expects back, paired with `EXPECTED_NFT_SENDER_SLOT`.\n   * @return The expected-NFT-token-id slot.\n   */\n  bytes32 public constant EXPECTED_NFT_TOKEN_ID_SLOT = keccak256('dromos.metarouter.nft.expectedTokenId');\n\n  /**\n   * @notice Registers a token brought into custody so it is returned to the caller at batch closure.\n   * @param _token ERC20 touched during the active batch.\n   */\n  function trackERC20(address _token) internal {\n    TransientTracking.track(ERC20_ARRAY_SLOT, TRACKED_SLOT, _token);\n  }\n\n  /**\n   * @notice Registers an NFT brought into custody so batch closure can verify it left the execution address.\n   * @dev Deduplicated per `(collection, tokenId)`; both are appended to the index-aligned arrays only on the first\n   *      touch.\n   * @param _collection NFT collection touched during the active batch.\n   * @param _tokenId Token id within `_collection`.\n   */\n  function trackNft(address _collection, uint256 _tokenId) internal {\n    bytes32 _flagSlot = _nftFlagSlot(_collection, _tokenId);\n    if (TransientTracking.load(_flagSlot) != 0) return;\n    TransientTracking.store(_flagSlot, 1);\n    TransientTracking.push(NFT_COLLECTION_ARRAY_SLOT, _collection);\n    TransientTracking.pushUint(NFT_TOKEN_ID_ARRAY_SLOT, _tokenId);\n  }\n\n  /**\n   * @notice Clears an NFT's custody deduplication flag.\n   * @dev Transient storage is transaction-scoped, so flags must be cleared between batches in one transaction.\n   * @param _collection NFT collection whose flag is cleared.\n   * @param _tokenId Token id within `_collection`.\n   */\n  function untrackNft(address _collection, uint256 _tokenId) internal {\n    TransientTracking.store(_nftFlagSlot(_collection, _tokenId), 0);\n  }\n\n  /**\n   * @notice Resets the NFT custody arrays for reuse in the same transaction.\n   */\n  function clearNftArrays() internal {\n    TransientTracking.clear(NFT_COLLECTION_ARRAY_SLOT);\n    TransientTracking.clear(NFT_TOKEN_ID_ARRAY_SLOT);\n  }\n\n  /**\n   * @notice Records the collection and position an inbound transfer is expected to return, and the sender it must come\n   *         from, ahead of the external call that returns it.\n   * @dev Mirrors the expected-callback-caller handshake the CL swap path uses: the sender slot must be empty, so a\n   *      command cannot overwrite another command's pending authorization. `onERC721Received` accepts a position only\n   *      while this is set and the caller, the transfer's `from`, and its token id all match; the receiver consumes it\n   *      before returning and the setting command verifies that consumption. Left unset the router solicits nothing,\n   *      and an unsolicited transfer cannot mint a custody flag a later command could operate. The withdrawal command\n   *      names the exact position it asks back, so binding the id as well keeps a misbehaving source from substituting\n   *      another position it custodies.\n   *\n   *      The collection is part of the authorization because the hook's arguments are supplied by its caller: without\n   *      it, any contract could present the expected sender and token id and have itself recorded as a custodied\n   *      collection. Two managers can also issue the same token id, so the collection is what keeps a position from one\n   *      of them out of state armed for the other.\n   * @param _collection Collection the position is expected to arrive from.\n   * @param _sender Address the position is expected to arrive from.\n   * @param _tokenId Position the sender is expected to return.\n   */\n  function setExpectedNft(address _collection, address _sender, uint256 _tokenId) internal {\n    if (TransientTracking.load(EXPECTED_NFT_SENDER_SLOT) != 0) revert IMetarouter.NftSenderNotCleared();\n    TransientTracking.store(EXPECTED_NFT_COLLECTION_SLOT, uint256(uint160(_collection)));\n    TransientTracking.store(EXPECTED_NFT_SENDER_SLOT, uint256(uint160(_sender)));\n    TransientTracking.store(EXPECTED_NFT_TOKEN_ID_SLOT, _tokenId);\n  }\n\n  /**\n   * @notice Consumes the expected NFT authorization once the requested position reaches the receiver.\n   * @dev All three fields are cleared before the receiver returns. The setting command verifies this consumption after\n   *      its external call, so an operation that returned no position reverts rather than leaving authorization behind.\n   */\n  function clearExpectedNft() internal {\n    TransientTracking.store(EXPECTED_NFT_COLLECTION_SLOT, 0);\n    TransientTracking.store(EXPECTED_NFT_SENDER_SLOT, 0);\n    TransientTracking.store(EXPECTED_NFT_TOKEN_ID_SLOT, 0);\n  }\n\n  /**\n   * @notice Records the single NFT a producer command leaves for a later command to consume.\n   * @dev Only one NFT may be in flight at a time, so a second producer before the first is consumed reverts. The\n   *      producer also tracks the NFT for custody so closure verifies it left even if no later command consumes it.\n   * @param _collection Collection of the produced NFT.\n   * @param _tokenId Token id of the produced NFT.\n   */\n  function setInFlightNft(address _collection, uint256 _tokenId) internal {\n    if (TransientTracking.load(IN_FLIGHT_COLLECTION_SLOT) != 0) revert IMetarouter.InFlightNftPresent();\n    TransientTracking.store(IN_FLIGHT_COLLECTION_SLOT, uint256(uint160(_collection)));\n    TransientTracking.store(IN_FLIGHT_TOKEN_ID_SLOT, _tokenId);\n  }\n\n  /**\n   * @notice Clears the in-flight slots when they hold the given NFT.\n   * @dev Called by a command that finishes using the in-flight NFT (staking, transferring, or burning it).\n   *      Batch closure never clears these slots, so consuming here is the only thing keeping a stale pair from\n   *      surviving into a later batch of the same transaction, where the next producer command would revert with\n   *      `InFlightNftPresent`. A no-op when the NFT is not the in-flight one.\n   * @param _collection Collection of the consumed NFT.\n   * @param _tokenId Token id of the consumed NFT.\n   */\n  function consumeInFlightNft(address _collection, uint256 _tokenId) internal {\n    (address _inFlightCollection, uint256 _inFlightTokenId) = inFlightNft();\n    if (_inFlightCollection == _collection && _inFlightTokenId == _tokenId) {\n      TransientTracking.store(IN_FLIGHT_COLLECTION_SLOT, 0);\n      TransientTracking.store(IN_FLIGHT_TOKEN_ID_SLOT, 0);\n    }\n  }\n\n  /**\n   * @notice Returns the position the router currently expects back, its collection, and the sender it must come from.\n   * @return _collection Expected collection.\n   * @return _sender Expected sender, or zero when the router solicited no position.\n   * @return _tokenId Position the expected sender must return.\n   */\n  function expectedNft() internal view returns (address _collection, address _sender, uint256 _tokenId) {\n    _collection = address(uint160(TransientTracking.load(EXPECTED_NFT_COLLECTION_SLOT)));\n    _sender = address(uint160(TransientTracking.load(EXPECTED_NFT_SENDER_SLOT)));\n    _tokenId = TransientTracking.load(EXPECTED_NFT_TOKEN_ID_SLOT);\n  }\n\n  /**\n   * @notice Returns the in-flight NFT, or `(address(0), 0)` when none is in flight.\n   * @return _collection In-flight NFT collection.\n   * @return _tokenId In-flight NFT token id.\n   */\n  function inFlightNft() internal view returns (address _collection, uint256 _tokenId) {\n    _collection = address(uint160(TransientTracking.load(IN_FLIGHT_COLLECTION_SLOT)));\n    _tokenId = TransientTracking.load(IN_FLIGHT_TOKEN_ID_SLOT);\n  }\n\n  /**\n   * @notice Resolves a command's position input, substituting the in-flight token id for the zero sentinel.\n   * @dev The position manager never mints token id zero, so zero is a safe sentinel for \"operate the NFT the batch just\n   *      produced\" whose id the plan could not know in advance. The sentinel resolves only when an in-flight NFT of the\n   *      expected collection is present, which binds the reference to the producer's exact output.\n   * @param _collection Collection the command operates on, matched against the in-flight collection for the sentinel.\n   * @param _tokenId Token id from the command, or zero to use the in-flight NFT.\n   * @return _resolved Concrete token id the command acts on.\n   */\n  function resolvePositionId(address _collection, uint256 _tokenId) internal view returns (uint256 _resolved) {\n    if (_tokenId != 0) return _tokenId;\n    (address _inFlightCollection, uint256 _inFlightTokenId) = inFlightNft();\n    if (_inFlightCollection != _collection) revert IMetarouter.NoInFlightNft();\n    return _inFlightTokenId;\n  }\n\n  /**\n   * @notice Returns whether an NFT is in the router's custody for the active batch.\n   * @dev Reads the NFT's own flag slot, not membership of the custody arrays. The two diverge: a command that releases\n   *      a position clears the flag while its array entry stays behind until closure resets the array lengths.\n   * @param _collection NFT collection to query.\n   * @param _tokenId Token id within `_collection`.\n   * @return _inCustody Whether the NFT entered custody during the active batch and has not been released.\n   */\n  function isNftInCustody(address _collection, uint256 _tokenId) internal view returns (bool _inCustody) {\n    return TransientTracking.load(_nftFlagSlot(_collection, _tokenId)) != 0;\n  }\n\n  /**\n   * @notice Number of NFTs brought into custody during the active batch.\n   * @return _length Count of tracked NFTs.\n   */\n  function trackedNftLength() internal view returns (uint256 _length) {\n    return TransientTracking.length(NFT_COLLECTION_ARRAY_SLOT);\n  }\n\n  /**\n   * @notice Returns a tracked NFT by index.\n   * @param _index Element index to read.\n   * @return _collection NFT collection at the index.\n   * @return _tokenId Token id at the index.\n   */\n  function trackedNftAt(uint256 _index) internal view returns (address _collection, uint256 _tokenId) {\n    _collection = TransientTracking.at(NFT_COLLECTION_ARRAY_SLOT, _index);\n    _tokenId = TransientTracking.atUint(NFT_TOKEN_ID_ARRAY_SLOT, _index);\n  }\n\n  /**\n   * @notice Returns the logical sender (outer caller) for the current batch.\n   * @return _sender Account whose assets and approvals command modules may use.\n   */\n  function msgSender() internal view returns (address _sender) {\n    return address(uint160(TransientTracking.load(LOCKER_SLOT)));\n  }\n\n  /**\n   * @notice Returns native ETH introduced during the active batch, excluding the pre-batch balance.\n   * @return _balance Native ETH available to spend this batch.\n   */\n  function availableNativeBalance() internal view returns (uint256 _balance) {\n    uint256 _nativeBalance = address(this).balance;\n    uint256 _nativeBalanceBefore = TransientTracking.load(NATIVE_BALANCE_BEFORE_SLOT);\n    if (_nativeBalance < _nativeBalanceBefore) revert IMetarouter.PreBatchNativeBalanceSpent();\n    return _nativeBalance - _nativeBalanceBefore;\n  }\n\n  /**\n   * @notice Returns a token balance the active batch may spend, which for the chain's native ERC20 is the\n   *         batch's own native converted to the native ERC20 decimals.\n   * @dev The native ERC20's `balanceOf` is the native balance in token decimals, so it is not read: spending the returned\n   *      amount moves that many raw native ERC20 units, and flooring the batch native keeps the movement within what the\n   *      batch introduced. The floored remainder only returns through the native refund. Every other token spends its\n   *      full balance.\n   * @param _token ERC20 whose available balance is read.\n   * @return _balance Token balance available to spend this batch.\n   */\n  function availableErc20Balance(address _token) internal view returns (uint256 _balance) {\n    if (_token == nativeErc20()) return availableNativeBalance() / nativeErc20Scale();\n    _balance = IERC20(_token).balanceOf(address(this));\n  }\n\n  /**\n   * @notice Returns the native ERC20 balance the active batch may spend once a committed native message fee\n   *         is reserved.\n   * @dev A native ERC20 pull and the native message fee draw from the same batch native, so the fee is deducted from the\n   *      batch native before the conversion to the native ERC20 decimals floors it. Saturates to zero instead of\n   *      underflowing. Only meaningful for the native ERC20; callers match the token against `nativeErc20`\n   *      first.\n   * @param _messageFee Native message fee committed alongside the native ERC20 spend.\n   * @return _balance Token balance available to spend this batch after the fee reservation.\n   */\n  function availableErc20BalanceAfterMessageFee(uint256 _messageFee) internal view returns (uint256 _balance) {\n    uint256 _nativeBalance = availableNativeBalance();\n    if (_messageFee >= _nativeBalance) return 0;\n    return (_nativeBalance - _messageFee) / nativeErc20Scale();\n  }\n\n  /**\n   * @notice Returns the chain's native ERC20 published for the active batch.\n   * @return _token The native ERC20, or zero when the chain has none.\n   */\n  function nativeErc20() internal view returns (address _token) {\n    return address(uint160(TransientTracking.load(NATIVE_ERC20_SLOT)));\n  }\n\n  /**\n   * @notice Returns the native value per raw native ERC20 unit published for the active batch.\n   * @return _scale Native value per raw native ERC20 unit; meaningful only while a native ERC20 is published.\n   */\n  function nativeErc20Scale() internal view returns (uint256 _scale) {\n    return TransientTracking.load(NATIVE_ERC20_SCALE_SLOT);\n  }\n\n  /**\n   * @notice Derives the transient deduplication-flag slot for an NFT.\n   * @param _collection NFT collection.\n   * @param _tokenId Token id within `_collection`.\n   * @return _slot Transient slot holding the NFT's custody flag.\n   */\n  function _nftFlagSlot(address _collection, uint256 _tokenId) private pure returns (bytes32 _slot) {\n    return keccak256(abi.encode(_collection, _tokenId, NFT_TRACKED_SLOT));\n  }\n}\n"},"V3/src/interfaces/factories/IFactoryRegistry.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IFactoryRegistry\n * @notice Per-chain approval gate for factories and relationship graph of the\n *         protocol. Tracks which gauge factories and target factories may\n *         participate on the chain, records how gauges, targets, factories\n *         and rewards contracts relate and holds the meta router allowlist.\n */\ninterface IFactoryRegistry {\n  /**\n   * @notice Emitted when a gauge factory is registered into the approval set.\n   * @param _gaugeFactory The registered gauge factory.\n   */\n  event GaugeFactoryRegistered(address indexed _gaugeFactory);\n\n  /**\n   * @notice Emitted when a gauge factory and a target factory are linked.\n   * @param _gaugeFactory The linked gauge factory.\n   * @param _targetFactory The target factory the gauge factory serves.\n   */\n  event FactoriesLinked(address indexed _gaugeFactory, address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when a gauge factory is removed from the approval set.\n   * @param _gaugeFactory The unregistered gauge factory.\n   */\n  event GaugeFactoryUnregistered(address indexed _gaugeFactory);\n\n  /**\n   * @notice Emitted when a target factory is registered into the approval set.\n   * @param _targetFactory The registered target factory.\n   */\n  event TargetFactoryRegistered(address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when a target factory is removed from the approval set.\n   * @param _targetFactory The unregistered target factory.\n   */\n  event TargetFactoryUnregistered(address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when a target factory records a freshly deployed target.\n   * @param _target The recorded target.\n   * @param _targetFactory The target factory that deployed the target.\n   */\n  event TargetCreated(address indexed _target, address indexed _targetFactory);\n\n  /**\n   * @notice Emitted when the GaugeManager records a freshly created gauge.\n   * @param _gauge The recorded gauge.\n   * @param _gaugeFactory The gauge factory that deployed the gauge.\n   * @param _target The target the gauge points at.\n   * @param _rewards The gauge's rewards contract.\n   */\n  event GaugeRegistered(\n    address indexed _gauge, address indexed _gaugeFactory, address indexed _target, address _rewards\n  );\n\n  /**\n   * @notice Emitted when the TokenRegistry pointer is updated.\n   * @param _tokenRegistry The new TokenRegistry.\n   */\n  event TokenRegistrySet(address indexed _tokenRegistry);\n\n  /**\n   * @notice Emitted when the LeafVoter is wired in.\n   * @param _leafVoter The LeafVoter address.\n   */\n  event LeafVoterSet(address indexed _leafVoter);\n\n  /**\n   * @notice Emitted when the target factory admin is set.\n   * @param _targetFactoryAdmin The new target factory admin.\n   */\n  event TargetFactoryAdminSet(address indexed _targetFactoryAdmin);\n\n  /**\n   * @notice Emitted when a meta router is registered into the approval set.\n   * @param _metaRouter The registered meta router.\n   */\n  event MetaRouterRegistered(address indexed _metaRouter);\n\n  /**\n   * @notice Emitted when a meta router is removed from the approval set.\n   * @param _metaRouter The unregistered meta router.\n   */\n  event MetaRouterUnregistered(address indexed _metaRouter);\n\n  /**\n   * @notice Thrown when the caller lacks the required authorization.\n   */\n  error NotAuthorized();\n\n  /**\n   * @notice Thrown when a zero address is invalid.\n   */\n  error ZeroAddress();\n\n  /**\n   * @notice Thrown when registering an entry already in its approval set.\n   */\n  error AlreadyRegistered();\n\n  /**\n   * @notice Thrown when unregistering an entry not in its approval set.\n   */\n  error NotRegistered();\n\n  /**\n   * @notice Thrown when a target factory required by the operation is not in the approval set.\n   */\n  error TargetFactoryNotRegistered();\n\n  /**\n   * @notice Thrown when a gauge factory required by the operation is not in the approval set.\n   */\n  error GaugeFactoryNotRegistered();\n\n  /**\n   * @notice Thrown when registering a target already recorded in the registry.\n   */\n  error TargetAlreadyRecorded();\n\n  /**\n   * @notice Thrown when registering a gauge already recorded in the registry.\n   */\n  error GaugeAlreadyRecorded();\n\n  /**\n   * @notice Thrown when registering a gauge with a rewards contract already recorded for another gauge.\n   */\n  error RewardsAlreadyRecorded();\n\n  /**\n   * @notice Thrown when adding an entry already present in a factory enumeration.\n   */\n  error AlreadyEnumerated();\n\n  /**\n   * @notice Thrown when linking a gauge to a target not recorded in the registry.\n   */\n  error TargetNotRecorded();\n\n  /**\n   * @notice Thrown when linking a gauge to a target already linked to a gauge.\n   */\n  error TargetAlreadyLinked();\n\n  /**\n   * @notice Thrown when linking a gauge to a target not deployed by its factory's linked target factory.\n   */\n  error TargetFactoryMismatch();\n\n  /**\n   * @notice Thrown when registering a gauge factory against a target factory other than its linked one.\n   */\n  error GaugeFactoryAlreadyLinked();\n\n  /**\n   * @notice Thrown when registering a gauge factory against a target factory already linked to another gauge factory.\n   */\n  error TargetFactoryAlreadyLinked();\n\n  /**\n   * @notice Thrown when the operation requires a gauge factory with a linked target factory and none is recorded.\n   */\n  error NotLinked();\n\n  /**\n   * @notice Thrown when setting the LeafVoter after it has already been set.\n   */\n  error LeafVoterAlreadySet();\n\n  /**\n   * @notice Thrown when deploying with a target factory admin while the LeafVoter is provided.\n   */\n  error TargetFactoryAdminNotAllowed();\n\n  /**\n   * @notice Register a gauge factory and the target factory it serves as a\n   *         pair, writing their permanent one to one link on first\n   *         registration. The only writer of the link. Registering a\n   *         previously unregistered pair reapproves it against the recorded\n   *         link. The target factory may already be approved through the\n   *         target factory admin, in which case this call links it to its\n   *         gauge factory.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts on zero addresses, when either factory is linked to a\n   *      different counterpart and when the gauge factory is already in its\n   *      approval set.\n   * @param _gaugeFactory The gauge factory to register.\n   * @param _targetFactory The target factory the gauge factory serves.\n   */\n  function registerFactories(address _gaugeFactory, address _targetFactory) external;\n\n  /**\n   * @notice Register a target factory into the approval set without a gauge\n   *         factory pair. Lets the lite launch approve pool factories before\n   *         the LeafVoter and the gauge stack exist, with the gauge factory\n   *         linked later through registerFactories.\n   * @dev Caller must be the target factory admin. Reverts on the zero address\n   *      and a target factory already in the set.\n   * @param _targetFactory The target factory to register.\n   */\n  function registerTargetFactory(address _targetFactory) external;\n\n  /**\n   * @notice Wire the LeafVoter the registry resolves roles and the\n   *         GaugeManager through. The lite launch deploys the registry before\n   *         the LeafVoter, so the voter is set once by the target factory\n   *         admin here instead of at construction. Wiring the voter clears\n   *         the target factory admin, disabling the bootstrap role.\n   * @dev Caller must be the target factory admin. Reverts on the zero address\n   *      and when the LeafVoter is already set.\n   * @param _leafVoter The LeafVoter on this chain.\n   */\n  function setLeafVoter(address _leafVoter) external;\n\n  /**\n   * @notice Update the target factory admin.\n   * @dev Caller must be the target factory admin. Reverts on the zero address.\n   * @param _targetFactoryAdmin The new target factory admin.\n   */\n  function setTargetFactoryAdmin(address _targetFactoryAdmin) external;\n\n  /**\n   * @notice Remove a gauge factory and its linked target factory from their\n   *         approval sets as a pair. The link and every record the factories\n   *         established keep resolving.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Resolves the target factory through the recorded link. Reverts when\n   *      either factory is not in its approval set.\n   * @param _gaugeFactory The gauge factory of the pair to unregister.\n   */\n  function unregisterFactories(address _gaugeFactory) external;\n\n  /**\n   * @notice Update the TokenRegistry pointer. The registry is a peripheral\n   *         contract that can be replaced, so the pointer is settable.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts on the zero address.\n   * @param _tokenRegistry The new TokenRegistry.\n   */\n  function setTokenRegistry(address _tokenRegistry) external;\n\n  /**\n   * @notice Add a meta router to the approval set. Multiple meta routers can\n   *         be approved at once so older versions keep working while new ones\n   *         roll out.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts on the zero address and a meta router already in the set.\n   * @param _metaRouter The meta router to register.\n   */\n  function registerMetaRouter(address _metaRouter) external;\n\n  /**\n   * @notice Remove a meta router from the approval set.\n   * @dev Caller must hold FACTORY_REGISTRY_ADMIN_ROLE on the LeafVoter.\n   *      Reverts when the meta router is not in the set.\n   * @param _metaRouter The meta router to unregister.\n   */\n  function unregisterMetaRouter(address _metaRouter) external;\n\n  /**\n   * @notice Record a freshly deployed target. Called by the target factory\n   *         inside its own creation function.\n   * @dev msg.sender must be a registered target factory, so a factory outside\n   *      the approval set cannot deploy at all. Reverts on the zero address, a\n   *      target already recorded and a target already in the factory\n   *      enumeration.\n   * @param _target The deployed target.\n   */\n  function registerTarget(address _target) external;\n\n  /**\n   * @notice Record a freshly created gauge with its factory, rewards contract\n   *         and target link. Called by the GaugeManager in the creation\n   *         transaction. Writes both sides of the link, which is permanent\n   *         with no later write path.\n   * @dev msg.sender must be the GaugeManager, resolved through the LeafVoter.\n   *      The gauge factory must be\n   *      registered and linked and the target recorded by that factory's\n   *      linked target factory. Reverts on zero addresses, a gauge already recorded or\n   *      enumerated, a rewards contract already recorded and a target already\n   *      linked to a gauge, so the record is write once in every direction.\n   * @param _gauge The deployed gauge.\n   * @param _gaugeFactory The gauge factory that deployed it.\n   * @param _rewards The gauge's rewards contract.\n   * @param _target The target the gauge points at.\n   */\n  function registerGauge(address _gauge, address _gaugeFactory, address _rewards, address _target) external;\n\n  /**\n   * @notice True when the gauge factory is in the approval set.\n   * @param _gaugeFactory The gauge factory to check.\n   * @return _approved Whether the gauge factory is registered.\n   */\n  function isGaugeFactoryApproved(address _gaugeFactory) external view returns (bool _approved);\n\n  /**\n   * @notice True when the target factory is in the approval set.\n   * @param _targetFactory The target factory to check.\n   * @return _approved Whether the target factory is registered.\n   */\n  function isTargetFactoryApproved(address _targetFactory) external view returns (bool _approved);\n\n  /**\n   * @notice True when the meta router is in the approval set. Gauges resolve\n   *         this check to allow a meta router to deposit on behalf of a user.\n   * @param _metaRouter The meta router to check.\n   * @return _approved Whether the meta router is registered.\n   */\n  function isMetaRouterApproved(address _metaRouter) external view returns (bool _approved);\n\n  /**\n   * @notice The registered gauge factories.\n   * @return _factories The gauge factory approval set as an array.\n   */\n  function gaugeFactories() external view returns (address[] memory _factories);\n\n  /**\n   * @notice The number of registered gauge factories.\n   * @return _length The gauge factory approval set member count.\n   */\n  function gaugeFactoriesLength() external view returns (uint256 _length);\n\n  /**\n   * @notice The registered gauge factory at an index.\n   * @param _index The index to read.\n   * @return _factory The member at the index, zero for an out of range index.\n   */\n  function gaugeFactoriesAt(uint256 _index) external view returns (address _factory);\n\n  /**\n   * @notice The registered target factories.\n   * @return _factories The target factory approval set as an array.\n   */\n  function targetFactories() external view returns (address[] memory _factories);\n\n  /**\n   * @notice The number of registered target factories.\n   * @return _length The target factory approval set member count.\n   */\n  function targetFactoriesLength() external view returns (uint256 _length);\n\n  /**\n   * @notice The registered target factory at an index.\n   * @param _index The index to read.\n   * @return _factory The member at the index, zero for an out of range index.\n   */\n  function targetFactoriesAt(uint256 _index) external view returns (address _factory);\n\n  /**\n   * @notice The registered meta routers.\n   * @return _metaRouters The meta router approval set as an array.\n   */\n  function metaRouters() external view returns (address[] memory _metaRouters);\n\n  /**\n   * @notice The targets recorded by a target factory.\n   * @param _factory The target factory to enumerate.\n   * @return _targets The targets the factory deployed as an array.\n   */\n  function factoryToTargets(address _factory) external view returns (address[] memory _targets);\n\n  /**\n   * @notice The number of targets recorded by a target factory.\n   * @param _factory The target factory to enumerate.\n   * @return _length The recorded target count.\n   */\n  function factoryToTargetsLength(address _factory) external view returns (uint256 _length);\n\n  /**\n   * @notice The target recorded by a target factory at an index.\n   * @param _factory The target factory to enumerate.\n   * @param _index The index to read.\n   * @return _target The member at the index, zero for an out of range index.\n   */\n  function factoryToTargetsAt(address _factory, uint256 _index) external view returns (address _target);\n\n  /**\n   * @notice The gauges recorded by a gauge factory.\n   * @param _factory The gauge factory to enumerate.\n   * @return _gauges The gauges the factory deployed as an array.\n   */\n  function factoryToGauges(address _factory) external view returns (address[] memory _gauges);\n\n  /**\n   * @notice The number of gauges recorded by a gauge factory.\n   * @param _factory The gauge factory to enumerate.\n   * @return _length The recorded gauge count.\n   */\n  function factoryToGaugesLength(address _factory) external view returns (uint256 _length);\n\n  /**\n   * @notice The gauge recorded by a gauge factory at an index.\n   * @param _factory The gauge factory to enumerate.\n   * @param _index The index to read.\n   * @return _gauge The member at the index, zero for an out of range index.\n   */\n  function factoryToGaugesAt(address _factory, uint256 _index) external view returns (address _gauge);\n\n  /**\n   * @notice Emission cap for a gauge, read from the factory that deployed it.\n   * @dev Returns zero when the gauge is unknown or the factory call reverts.\n   *      Resolves through the recorded gauge to factory link, so unregistering\n   *      a factory stops new gauges but leaves existing caps intact.\n   * @param _gauge The gauge to resolve.\n   * @return _cap The gauge emission cap in tokens per second.\n   */\n  function emissionCap(address _gauge) external view returns (uint128 _cap);\n\n  /**\n   * @notice LeafVoter on this chain. Resolves roles for every permissioned\n   *         registration function and the GaugeManager for gauge recording.\n   *         Set at construction in a regular deployment. In the lite launch\n   *         it is zero until the target factory admin wires it in through\n   *         setLeafVoter.\n   * @return _leafVoter The LeafVoter address.\n   */\n  function leafVoter() external view returns (address _leafVoter);\n\n  /**\n   * @notice Bootstrap authority of the registry, added for the lite launch\n   *         where the registry deploys before the LeafVoter. Registers target\n   *         factories before the LeafVoter exists and wires the LeafVoter in\n   *         once deployed.\n   * @return _targetFactoryAdmin The target factory admin address, zero once\n   *         the LeafVoter is set.\n   */\n  function targetFactoryAdmin() external view returns (address _targetFactoryAdmin);\n\n  /**\n   * @notice TokenRegistry supplying token listing checks on this chain.\n   * @return _tokenRegistry The current TokenRegistry, zero during a pool-only lite launch until configured.\n   */\n  function tokenRegistry() external view returns (address _tokenRegistry);\n\n  /**\n   * @notice Gauge factory that deployed each gauge. Written once when the\n   *         GaugeManager records the gauge.\n   * @param _gauge The gauge to resolve.\n   * @return _factory The deploying gauge factory, zero for an unknown gauge.\n   */\n  function gaugeToFactory(address _gauge) external view returns (address _factory);\n\n  /**\n   * @notice Target factory that deployed each target. Written once when the\n   *         factory records the target.\n   * @param _target The target to resolve.\n   * @return _factory The deploying target factory, zero for an unknown target.\n   */\n  function targetToFactory(address _target) external view returns (address _factory);\n\n  /**\n   * @notice The target a gauge points at. Written once when the GaugeManager\n   *         records the gauge, with no later write path.\n   * @param _gauge The gauge to resolve.\n   * @return _target The linked target, zero for a gauge with no target.\n   */\n  function gaugeToTarget(address _gauge) external view returns (address _target);\n\n  /**\n   * @notice The gauge over a target. Written once when the GaugeManager\n   *         records the gauge, together with the forward direction, with no\n   *         later write path.\n   * @param _target The target to resolve.\n   * @return _gauge The linked gauge, zero for a target with no gauge.\n   */\n  function targetToGauge(address _target) external view returns (address _gauge);\n\n  /**\n   * @notice The target factory a gauge factory serves. Written once by the\n   *         pair registration entrypoint and never modified afterwards,\n   *         including across reregistration.\n   * @param _gaugeFactory The gauge factory to resolve.\n   * @return _targetFactory The linked target factory, zero for an unlinked factory.\n   */\n  function gaugeFactoryToTargetFactory(address _gaugeFactory) external view returns (address _targetFactory);\n\n  /**\n   * @notice The gauge factory serving a target factory. Written once together\n   *         with the forward direction and never modified afterwards,\n   *         including across reregistration.\n   * @param _targetFactory The target factory to resolve.\n   * @return _gaugeFactory The linked gauge factory, zero for an unlinked factory.\n   */\n  function targetFactoryToGaugeFactory(address _targetFactory) external view returns (address _gaugeFactory);\n\n  /**\n   * @notice Rewards contract escrowing fees and incentives for each gauge.\n   *         Written once when the GaugeManager records the gauge.\n   * @param _gauge The gauge to resolve.\n   * @return _rewards The rewards contract, zero for an unknown gauge.\n   */\n  function gaugeToRewards(address _gauge) external view returns (address _rewards);\n\n  /**\n   * @notice Gauge behind each rewards contract. Written once when the\n   *         GaugeManager records the gauge, together with the forward\n   *         direction. Rewards contracts carry no gauge reference, so this is\n   *         the only on-chain path from a rewards contract back to its gauge.\n   * @param _rewards The rewards contract to resolve.\n   * @return _gauge The recorded gauge, zero for an unknown rewards contract.\n   */\n  function rewardsToGauge(address _rewards) external view returns (address _gauge);\n}\n"},"V3/src/interfaces/token/IBaseTokenExtensions.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @title IBaseTokenExtensions\n/// @notice Interface for token custom behavior shared by every protocol token.\ninterface IBaseTokenExtensions {\n  /// @notice Thrown when an address parameter is the zero address.\n  error ZeroAddress();\n}\n"},"V3/src/interfaces/bridge/IMessageOrchestrator.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IMessageOrchestrator\n * @notice Shared inbound entrypoint of every orchestrator. Registered adapters call `route`, which checks the caller\n * and the nonce, then hands the body to a typed handler.\n */\ninterface IMessageOrchestrator {\n  /**\n   * @notice Routing identifier stamped into the message header and read to pick the typed handler.\n   * @param None Zero-default guard, rejected at decode so an empty payload cannot pass as the first real type.\n   * @param AllocateChain Root to leaf — sets a tokenId's chain-level VP budget and the chain emissions scalar.\n   * @param AllocateGauge Root to leaf — distributes a chain budget across gauges; cooldown-gated on the leaf.\n   * @param ClaimRewards Root to leaf — claims fee and incentive rewards.\n   * @param Redeem Leaf to root — Redeem.\n   * @param SetOperator Root to leaf — propagates the per-tokenId operator assignment.\n   * @param Deallocate Leaf to root — confirms a tokenId's deallocation so root credits `CHAIN0`.\n   * @param ReduceCooldown Root to leaf — accrues a tokenId's pending cooldown reduction.\n   * @param EmergencyDeallocate Root to leaf — clears a tokenId's gauges and cuts its chain budget by the drained\n   * amount, so a Suspended chain re-syncs when it is next reachable.\n   */\n  enum MessageType {\n    None,\n    AllocateChain,\n    AllocateGauge,\n    ClaimRewards,\n    Redeem,\n    SetOperator,\n    Deallocate,\n    ReduceCooldown,\n    EmergencyDeallocate\n  }\n\n  /// @notice Emitted when an outbound message is handed to a transport adapter and its nonce is stamped.\n  /// @param _chainId Destination chain id.\n  /// @param _chainNonce Outbound nonce stamped on this message.\n  /// @param _msgType Routing identifier carried by the message.\n  event MessageDispatched(uint256 indexed _chainId, uint256 _chainNonce, MessageType _msgType);\n\n  /// @notice Emitted when an inbound message is accepted and its nonce is consumed.\n  /// @param _chainId Source chain id.\n  /// @param _chainNonce Nonce stamped by the source orchestrator.\n  /// @param _msgType Routing identifier carried by the message.\n  event MessageReceived(uint256 indexed _chainId, uint256 _chainNonce, MessageType _msgType);\n\n  /// @notice Reverts when the inbound payload is too short to contain the wrapped header.\n  error InvalidPayload();\n\n  /// @notice Reverts when the inbound message type byte is above the `MessageType` enum range.\n  error InvalidMessageType();\n\n  /// @notice Reverts when the inbound message type byte is the `None` zero value, never a routable type.\n  error NoneMessageType();\n\n  /// @notice Reverts when a supplied address parameter is the zero address.\n  error ZeroAddress();\n\n  /// @notice Reverts when `dispatch` is called and no adapter is registered for the destination.\n  error AdapterNotRegistered();\n\n  /// @notice Reverts when `dispatch` is called by anyone other than the local voter contract.\n  error CallerNotAuthorized();\n\n  /// @notice Reverts when a `MessageType` is not routable in the current direction.\n  error UnsupportedMessageType();\n\n  /// @notice Reverts when `route` is called by anyone other than the registered adapter.\n  error CallerNotAdapter();\n\n  /// @notice Reverts when the inbound `chainNonce` has already been consumed.\n  error NonceAlreadyUsed();\n\n  /// @notice Reverts while the local clock trails the message's `dispatchedAt`; the transport redelivers once it\n  ///         catches up, so a chain resuming from an outage cannot start accrual before the sender booked it.\n  error ClockBehindDispatch();\n\n  /// @notice Reverts when an adapter setter is called without `ADAPTER_CONFIG_ROLE` on the local voter.\n  error CallerNotAdapterAuthority();\n\n  /// @notice Reverts when `setAdapter` is invoked with the zero address.\n  error InvalidAdapter();\n\n  /**\n   * @notice Routes a message delivered by a registered adapter to the orchestrator's typed handler.\n   * @dev Registered adapter only. Nonces are single-use. Root rejects a `Redeem` from a suspended origin but still\n   *      takes a `Deallocate`; the leaf routes while suspended so held root messages keep applying.\n   * @dev `payable` so a relayer can send a deallocation return fee: on the leaf it lands in the pre-funding pool\n   *      that pays the return. Root has no use for inbound value.\n   * @param _originChainId Source chain id, supplied by the adapter from its `REMOTE_CHAIN_ID`.\n   * @param _payload The wrapped message to decode and route.\n   */\n  function route(uint256 _originChainId, bytes calldata _payload) external payable;\n}\n"},"V3/src/interfaces/relay/IRelayFactoryRegistry.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/**\n * @title IRelayFactoryRegistry\n * @notice Approval set of the relay factories the protocol trusts. A consumer handed a relay address\n *         resolves the relay's factory, checks it here, then asks that factory whether it created\n *         the relay. The set is governed by GOVERNANCE_ROLE on the root Voter, a seat above the\n *         relay deployer. It gates what a consumer accepts, not relay creation. The factory checks only\n *         RELAY_DEPLOYER_ROLE, and a relay keeps taking direct deposits whether or not its factory is in\n *         the set.\n */\ninterface IRelayFactoryRegistry {\n  /**\n   * @notice Emitted when a relay factory enters the approval set.\n   * @param _relayFactory The relay factory registered.\n   */\n  event RelayFactoryRegistered(address indexed _relayFactory);\n\n  /**\n   * @notice Emitted when a relay factory leaves the approval set.\n   * @param _relayFactory The relay factory unregistered.\n   */\n  event RelayFactoryUnregistered(address indexed _relayFactory);\n\n  /// @notice Thrown when the caller lacks GOVERNANCE_ROLE on the Voter.\n  error NotAuthorized();\n\n  /// @notice Thrown when a zero address is supplied where an address is required.\n  error ZeroAddress();\n\n  /// @notice Thrown when registering a relay factory already in the approval set.\n  error AlreadyRegistered();\n\n  /// @notice Thrown when unregistering a relay factory not in the approval set.\n  error NotRegistered();\n\n  /**\n   * @notice Add a relay factory to the approval set. Multiple relay factories can be approved at\n   *         once so relays of an older factory keep working while a new one rolls out.\n   * @dev Caller must hold GOVERNANCE_ROLE on the Voter. Reverts on the zero address and a relay\n   *      factory already in the set.\n   * @param _relayFactory The relay factory to register.\n   */\n  function registerRelayFactory(address _relayFactory) external;\n\n  /**\n   * @notice Remove a relay factory from the approval set. Every relay that factory created stops\n   *         passing the consumers' checks at once. Direct calls on those relays are untouched.\n   * @dev Caller must hold GOVERNANCE_ROLE on the Voter. Reverts when the relay factory is not\n   *      in the set.\n   * @param _relayFactory The relay factory to unregister.\n   */\n  function unregisterRelayFactory(address _relayFactory) external;\n\n  /**\n   * @notice True when the relay factory is in the approval set.\n   * @dev Membership alone does not authenticate a relay. A spoofed relay can report any factory, so\n   *      a consumer must also ask the approved factory whether it created the relay.\n   * @param _relayFactory The relay factory to check.\n   * @return _approved Whether the relay factory is registered.\n   */\n  function isRelayFactoryApproved(address _relayFactory) external view returns (bool _approved);\n\n  /**\n   * @notice The registered relay factories.\n   * @return _factories The relay factory approval set as an array.\n   */\n  function relayFactories() external view returns (address[] memory _factories);\n\n  /**\n   * @notice The number of registered relay factories.\n   * @return _length The size of the approval set.\n   */\n  function relayFactoriesLength() external view returns (uint256 _length);\n\n  /**\n   * @notice The relay factory at an index of the approval set.\n   * @param _index The index to read.\n   * @return _relayFactory The member at the index, zero for an out of range index.\n   */\n  function relayFactoriesAt(uint256 _index) external view returns (address _relayFactory);\n\n  /**\n   * @notice The Voter whose GOVERNANCE_ROLE governs the approval set.\n   * @return _voter The Voter address.\n   */\n  function VOTER() external view returns (address _voter);\n}\n"},"V3/src/interfaces/token/IReceiptTokenExtensions.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IBaseTokenExtensions} from 'V3/interfaces/token/IBaseTokenExtensions.sol';\n\n/// @title IReceiptTokenExtensions\n/// @notice Interface for ReceiptToken custom behavior not covered by the ERC20 interface.\ninterface IReceiptTokenExtensions is IBaseTokenExtensions {\n  /// @notice Thrown when a caller other than the leaf voter tries to mint or burn tokens.\n  error NotLeafVoter();\n\n  /// @notice Mints receipt tokens to an account.\n  /// @param _to The account that receives the minted tokens.\n  /// @param _amount The amount of tokens to mint.\n  function mint(address _to, uint256 _amount) external;\n\n  /// @notice Burns receipt tokens from an account.\n  /// @param _from The account whose tokens are burned.\n  /// @param _amount The amount of tokens to burn.\n  function burn(address _from, uint256 _amount) external;\n\n  /// @notice Returns the leaf voter address.\n  /// @return _leafVoter The address allowed to mint and burn receipt tokens.\n  function LEAF_VOTER() external view returns (address _leafVoter);\n}\n"},"node_modules/@openzeppelin/contracts/utils/Panic.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n *      using Panic for uint256;\n *\n *      // Use any of the declared internal constants\n *      function foo() { Panic.GENERIC.panic(); }\n *\n *      // Alternatively\n *      function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n    /// @dev generic / unspecified error\n    uint256 internal constant GENERIC = 0x00;\n    /// @dev used by the assert() builtin\n    uint256 internal constant ASSERT = 0x01;\n    /// @dev arithmetic underflow or overflow\n    uint256 internal constant UNDER_OVERFLOW = 0x11;\n    /// @dev division or modulo by zero\n    uint256 internal constant DIVISION_BY_ZERO = 0x12;\n    /// @dev enum conversion error\n    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n    /// @dev invalid encoding in storage\n    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n    /// @dev empty array pop\n    uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n    /// @dev array out of bounds access\n    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n    /// @dev resource error (too large allocation or too large array)\n    uint256 internal constant RESOURCE_ERROR = 0x41;\n    /// @dev calling invalid internal function\n    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n    /// @dev Reverts with a panic code. Recommended to use with\n    /// the internal constants with predefined codes.\n    function panic(uint256 code) internal pure {\n        assembly (\"memory-safe\") {\n            mstore(0x00, 0x4e487b71)\n            mstore(0x20, code)\n            revert(0x1c, 0x24)\n        }\n    }\n}\n"},"V3/src/interfaces/bridge/ILeafMessageOrchestrator.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IMessageAdapter} from 'V3/interfaces/bridge/IMessageAdapter.sol';\nimport {IMessageOrchestrator} from 'V3/interfaces/bridge/IMessageOrchestrator.sol';\nimport {ILeafVoter} from 'V3/interfaces/voter/ILeafVoter.sol';\n\n/**\n * @title ILeafMessageOrchestrator\n * @notice Leaf-side orchestrator: sends outbound messages to root and routes inbound root messages to the\n * `LeafVoter`.\n * @dev Holds the pre-funding pool that pays root-triggered deallocation returns.\n */\ninterface ILeafMessageOrchestrator is IMessageOrchestrator {\n  /// @notice Emitted when the registered adapter for the root pair is updated.\n  /// @param _current The newly registered adapter.\n  event AdapterUpdated(IMessageAdapter _current);\n\n  /// @notice Emitted when the destination gas limit for a deallocation return is set.\n  /// @param _gasLimit The gas reserved for root's handler of the return.\n  event DeallocationGasLimitSet(uint256 _gasLimit);\n\n  /// @notice Emitted when pre-funding is withdrawn from the orchestrator.\n  /// @param _destination Address that received the withdrawal.\n  /// @param _amount Native amount withdrawn.\n  event NativeWithdrawn(address indexed _destination, uint256 _amount);\n\n  /// @notice Emitted when an inbound claim or operator message arrives past its root-stamped expiry and is dropped.\n  /// @dev The message's nonces stay committed: an expired message never becomes executable, and consuming its\n  ///      nonces keeps older in-flight messages from applying after it.\n  /// @param _msgType Type of the dropped message.\n  /// @param _tokenId veNFT id the dropped message targeted.\n  event ExpiredMessageDropped(MessageType indexed _msgType, uint256 indexed _tokenId);\n\n  /// @notice Reverts when the orchestrator is deployed with a zero `ROOT_CHAIN_ID`, which no adapter could match.\n  error InvalidRootChainId();\n\n  /// @notice Reverts when `setAdapter` is given an adapter whose `REMOTE_CHAIN_ID` is not `ROOT_CHAIN_ID`.\n  error AdapterChainIdMismatch();\n\n  /// @notice Reverts when a `Deallocate` is underfunded: the caller's value or the pool is below the quoted fee.\n  error InsufficientDeallocationMessageValue();\n\n  /// @notice Reverts when a gas-limit setter is called by an address without `GAS_CONFIGURER_ROLE`.\n  error CallerNotGasConfigurer();\n\n  /// @notice Reverts when a gas-limit setter receives zero.\n  error ZeroGasLimit();\n\n  /// @notice Reverts when `withdrawNative` is called by an address without `NATIVE_WITHDRAWER_ROLE`.\n  error CallerNotNativeWithdrawer();\n\n  /// @notice Reverts when the native transfer in `withdrawNative` fails.\n  error WithdrawFailed();\n\n  /// @notice Sets the registered adapter for the root pair. `ADAPTER_CONFIG_ROLE` on the `LeafVoter` only.\n  /// @dev Reverts unless `_adapter.REMOTE_CHAIN_ID()` is `ROOT_CHAIN_ID`, so the leaf's only authenticated route\n  ///      points at root and no other chain can authenticate root-only messages.\n  /// @param _adapter The adapter to register for the root pair.\n  function setAdapter(IMessageAdapter _adapter) external;\n\n  /**\n   * @notice Sends an outbound `Redeem` or `Deallocate` to root through the registered adapter. `LeafVoter` only.\n   * @dev No status check: the `LeafVoter` enforces the status (`redeem` is `chainIsActiveOrSunset`, open only while\n   *      Active or Sunset), and a `Deallocate` goes out even while Suspended so root's booking stays right\n   *      ahead of an emergency deallocation.\n   * @dev A `Deallocate` must cover a live adapter quote, so no configured cost can drift from the real fee.\n   *      Pool-funded draws the exact quote and refunds back into the pool; otherwise the whole `msg.value` goes out.\n   * @param _msgType Routing identifier consumed by the destination handler.\n   * @param _payload Message body; the header is added before sending.\n   * @param _gasLimit Destination gas. Ignored for `Deallocate`, which uses the configured `deallocationGasLimit`.\n   * @param _refundRecipient Transport refund recipient. Ignored when `_fundFromPool` refunds into the pool.\n   * @param _fundFromPool Whether to draw the quoted fee from the pre-funding pool instead of `msg.value`.\n   */\n  function dispatch(\n    MessageType _msgType,\n    bytes calldata _payload,\n    uint256 _gasLimit,\n    address _refundRecipient,\n    bool _fundFromPool\n  ) external payable;\n\n  /// @notice Sets the destination gas limit stamped on every deallocation return. `GAS_CONFIGURER_ROLE` only.\n  /// @dev `dispatch` and `quoteDispatch` both read it for `Deallocate`, so a quote is never taken against a\n  ///      different budget than the send uses.\n  /// @param _gasLimit New destination gas limit for deallocation returns.\n  function setDeallocationGasLimit(uint256 _gasLimit) external;\n\n  /// @notice Withdraws the pre-funding held for root-triggered deallocation returns. `NATIVE_WITHDRAWER_ROLE` only.\n  /// @dev Also the recovery path for inbound message value that arrived without a deallocation to spend it on.\n  /// @param _amount Native amount to withdraw.\n  /// @param _destination Address that receives the withdrawal.\n  function withdrawNative(uint256 _amount, address _destination) external;\n\n  /**\n   * @notice Quotes the native fee a `dispatch` with the same arguments would need.\n   * @dev Prices the wrapped envelope, not the bare payload. The header is fixed-width, so the nonce cannot move the\n   *      quote and a dispatch landing in between cannot invalidate it.\n   * @dev Reverts `AdapterNotRegistered` if no adapter is registered.\n   * @param _msgType Routing identifier the dispatch would stamp.\n   * @param _payload Message body the dispatch would wrap.\n   * @param _gasLimit Destination gas. Ignored for `Deallocate`, priced against `deallocationGasLimit`.\n   * @param _refundRecipient Address the dispatch would name as the transport's refund recipient.\n   * @return _fee Native amount the matching `dispatch` requires.\n   */\n  function quoteDispatch(\n    MessageType _msgType,\n    bytes calldata _payload,\n    uint256 _gasLimit,\n    address _refundRecipient\n  ) external view returns (uint256 _fee);\n\n  /// @notice Local `LeafVoter` bound to this orchestrator at deployment.\n  /// @dev The only caller allowed to `dispatch`, and the source of the roles checked here.\n  /// @return Local `LeafVoter`.\n  function LEAF_VOTER() external view returns (ILeafVoter);\n\n  /// @notice Chain id of root, the only chain this leaf orchestrator messages. Set at deployment.\n  /// @dev `setAdapter` requires the registered adapter's `REMOTE_CHAIN_ID` to equal this.\n  /// @return Root chain id.\n  function ROOT_CHAIN_ID() external view returns (uint256);\n\n  /// @notice Registered transport adapter for the root pair, or zero if none.\n  /// @return Registered adapter.\n  function adapter() external view returns (IMessageAdapter);\n\n  /// @notice Destination gas limit stamped on every deallocation return, and the budget its fee is quoted against.\n  /// @dev Defaults to zero at deployment. Every `Deallocate` dispatch reverts until governance configures a nonzero\n  ///      limit. A root-triggered return keeps its inbound nonce and redelivers, but only until the allocation's\n  ///      root-stamped expiry: configure within `allocationLifetime` of going live or in-flight votes are lost.\n  /// @return _gasLimit Configured gas limit.\n  function deallocationGasLimit() external view returns (uint256 _gasLimit);\n\n  /// @notice Last outbound nonce stamped on a dispatch to root.\n  /// @return _lastNonce Last outbound nonce.\n  function nonceOut() external view returns (uint256 _lastNonce);\n\n  /// @notice Whether an inbound nonce has already been consumed.\n  /// @dev Single-use replay gate shared by every message type; the voting path adds its own ordering checks.\n  /// @param _nonce Inbound nonce to check.\n  /// @return _isUsed Whether `_nonce` has been consumed.\n  function noncesUsed(uint256 _nonce) external view returns (bool _isUsed);\n\n  /// @notice Highest inbound nonce applied to chain-level vote state.\n  /// @dev Gated apart from token state, so an out-of-order message skips a stale chain update without blocking its\n  ///      token allocation. Applies only when the inbound nonce is strictly greater.\n  /// @return _nonce Highest nonce applied to chain-level vote state.\n  function lastChainVoteNonce() external view returns (uint256 _nonce);\n\n  /// @notice Highest inbound nonce applied to a tokenId's vote and allocation state.\n  /// @dev Gated per tokenId, so a token still updates when its nonce is newer even after the chain nonce moved\n  ///      past it. Applies only when the inbound nonce is strictly greater.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Highest nonce applied to the tokenId's vote state.\n  function lastTokenIdVoteNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n\n  /// @notice Highest inbound nonce applied to a tokenId's operator mirror.\n  /// @dev Kept apart from the vote nonce, or whichever message lands first would mark the other stale. A\n  ///      `SetOperator` applies only when the inbound nonce is strictly greater.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Highest nonce applied to the tokenId's operator mirror.\n  function lastOperatorNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n\n  /// @notice Inbound nonce of the tokenId's last applied `EmergencyDeallocate` message.\n  /// @dev An `AllocateChain` at or below this ships a zero delta, so a message in flight when the emergency ran\n  ///      cannot bring back the cleared position. Zero until the tokenId's first emergency deallocation.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Inbound nonce of the tokenId's last emergency deallocation.\n  function lastEmergencyDeallocNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n\n  /// @notice Highest inbound nonce, across `AllocateChain` and `AllocateGauge`, allowed to refresh the token's shape.\n  /// @dev Both types carry a shape and advance this, so a delayed gauge vote cannot bring back a shape older than a\n  ///      chain reallocation that followed it; it books at the current shape instead.\n  /// @param _tokenId The tokenId to read.\n  /// @return _nonce Highest nonce that refreshed the tokenId's shape.\n  function lastShapeNonce(uint256 _tokenId) external view returns (uint256 _nonce);\n}\n"},"V3/src/interfaces/bridge/IRootMessageOrchestrator.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\nimport {IMessageAdapter} from 'V3/interfaces/bridge/IMessageAdapter.sol';\nimport {IMessageOrchestrator} from 'V3/interfaces/bridge/IMessageOrchestrator.sol';\nimport {IVoter} from 'V3/interfaces/voter/IVoter.sol';\n\n/**\n * @title IRootMessageOrchestrator\n * @notice Root-side orchestrator: sends outbound messages from the local `Voter` to many leaves and routes inbound\n * `Redeem` and `Deallocate` messages back to it.\n */\ninterface IRootMessageOrchestrator is IMessageOrchestrator {\n  /**\n   * @notice One destination's share of a dispatch sent by the `Voter`.\n   * @param chainId Destination chain id.\n   * @param gasLimit Execution gas reserved for the destination handler.\n   * @param nativeValue Transport fee, plus the kept `deallocationReturnCost` when `chargeDeallocationReturn` is set.\n   * @param chargeDeallocationReturn Whether to keep this chain's `deallocationReturnCost` out of `nativeValue`.\n   * @param payload Message body; the header is added before sending.\n   */\n  struct ChainDispatch {\n    uint256 chainId;\n    uint256 gasLimit;\n    uint256 nativeValue;\n    bool chargeDeallocationReturn;\n    bytes payload;\n  }\n\n  /// @notice Emitted when the registered adapter for a destination chain is updated.\n  /// @param _chainId Destination chain id whose adapter slot was updated.\n  /// @param _current The newly registered adapter.\n  event AdapterUpdated(uint256 _chainId, IMessageAdapter _current);\n\n  /// @notice Emitted when the deallocation return cost for a destination chain is set.\n  /// @param _chainId Destination chain id whose cost was set.\n  /// @param _cost The newly configured cost.\n  event DeallocationReturnCostSet(uint256 indexed _chainId, uint256 _cost);\n\n  /// @notice Emitted when the kept native ETH is withdrawn.\n  /// @param _destination Address that received the withdrawal.\n  /// @param _amount Native amount withdrawn.\n  event NativeWithdrawn(address indexed _destination, uint256 _amount);\n\n  /// @notice Reverts when `dispatch` gets a `msg.value` that does not equal the sum of every `nativeValue`.\n  error InvalidDispatchValue();\n\n  /// @notice Reverts when `setAdapter` is invoked with a chain id of zero, a value reserved as a sentinel.\n  error InvalidChainId();\n\n  /// @notice Reverts when `setAdapter` gets an adapter whose `REMOTE_CHAIN_ID` is not the registered chain id.\n  error AdapterChainIdMismatch();\n\n  /// @notice Reverts when a charging dispatch supplies a `nativeValue` below the chain's `deallocationReturnCost`.\n  error InsufficientDeallocationReturnCost();\n\n  /// @notice Reverts when a non-zero cost is set on the root-colocated leaf, whose adapter takes no transport value.\n  error DeallocationReturnCostNotAllowed();\n\n  /// @notice Reverts when a configuration call targets a chain the `Voter` has not registered.\n  /// @param _chainId The unregistered chain id.\n  error ChainNotRegistered(uint256 _chainId);\n\n  /// @notice Reverts when `setDeallocationReturnCost` is called by an address without `VOTER_CONFIG_ROLE`.\n  error CallerNotVoterConfigAuthority();\n\n  /// @notice Reverts when `withdrawNative` is called by an address without `NATIVE_WITHDRAWER_ROLE`.\n  error CallerNotNativeWithdrawer();\n\n  /// @notice Reverts when the native transfer in `withdrawNative` fails.\n  error WithdrawFailed();\n\n  /// @notice Sets the registered adapter for a destination chain. `ADAPTER_CONFIG_ROLE` on the `Voter` only.\n  /// @dev Reverts if `_chainId` is zero, `_adapter` is zero, or `_adapter.REMOTE_CHAIN_ID()` is not `_chainId`.\n  /// @param _chainId Destination chain id to register the adapter for.\n  /// @param _adapter The adapter to register. Must report `REMOTE_CHAIN_ID == _chainId`.\n  function setAdapter(uint256 _chainId, IMessageAdapter _adapter) external;\n\n  /**\n   * @notice Sends one outbound message per destination through the matching adapter. Local `Voter` only.\n   * @dev Reverts `InvalidDispatchValue` unless `msg.value` equals the sum of every `nativeValue`. Every adapter,\n   *      cost and fee is resolved before the first send, since a send hands control to `_refundRecipient`.\n   * @dev A destination with `chargeDeallocationReturn` keeps its chain's `deallocationReturnCost` here, withdrawable\n   *      to top the leaf up; only the rest is forwarded as the transport fee, which the caller quotes off-chain.\n   * @param _msgType Routing identifier shared by every dispatch.\n   * @param _dispatches Per-destination dispatches.\n   * @param _refundRecipient Address the transport refunds any excess fee to.\n   */\n  function dispatch(\n    MessageType _msgType,\n    ChainDispatch[] calldata _dispatches,\n    address _refundRecipient\n  ) external payable;\n\n  /// @notice Sets the native amount kept per dispatch that carries a deallocation return. `VOTER_CONFIG_ROLE` only.\n  /// @dev Reverts unless the chain is registered on the `Voter`. Must be zero for the root-colocated leaf, whose\n  ///      `RootLocalAdapter` takes no transport value.\n  /// @param _chainId Destination chain the cost applies to.\n  /// @param _cost Native amount kept on each charging dispatch to `_chainId`.\n  function setDeallocationReturnCost(uint256 _chainId, uint256 _cost) external;\n\n  /// @notice Withdraws the collected deallocation return costs. `NATIVE_WITHDRAWER_ROLE` on the `Voter` only.\n  /// @dev Pays for the manual leaf top-up that keeps each leaf able to front its return messages.\n  /// @param _amount Native amount to withdraw.\n  /// @param _destination Address that receives the withdrawal.\n  function withdrawNative(uint256 _amount, address _destination) external;\n\n  /// @notice Local `Voter` bound to this orchestrator at deployment.\n  /// @dev The only caller allowed to `dispatch`. It owns the chain registry and the roles checked here; the\n  ///      orchestrator holds none.\n  /// @return Local `Voter`.\n  function VOTER() external view returns (IVoter);\n\n  /// @notice Registered transport adapter for a destination chain, or zero if none.\n  /// @param _chainId Destination chain id.\n  /// @return Registered adapter for `_chainId`.\n  function adapters(uint256 _chainId) external view returns (IMessageAdapter);\n\n  /// @notice Native amount kept per dispatch that carries a deallocation return, covering the gas the leaf fronts.\n  /// @param _chainId Destination chain id.\n  /// @return _cost Configured cost for `_chainId`.\n  function deallocationReturnCost(uint256 _chainId) external view returns (uint256 _cost);\n\n  /// @notice Last outbound nonce stamped on a dispatch to a destination chain.\n  /// @param _chainId Destination chain id.\n  /// @return _lastNonce Last outbound nonce for `_chainId`.\n  function nonceOut(uint256 _chainId) external view returns (uint256 _lastNonce);\n\n  /// @notice Whether an inbound nonce has already been consumed for a source chain.\n  /// @dev Single-use replay gate: a nonce that reads true makes `route` revert `NonceAlreadyUsed`.\n  /// @param _chainId Source chain id.\n  /// @param _nonce Inbound nonce to check.\n  /// @return _isUsed Whether `_nonce` has been consumed for `_chainId`.\n  function noncesUsed(uint256 _chainId, uint256 _nonce) external view returns (bool _isUsed);\n}\n"},"V3/src/interfaces/external/IInterchainAccountRouter.sol":{"content":"// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.8.0;\n\n/**\n * @title IInterchainAccountRouter\n * @notice Minimal view of the Hyperlane Interchain Account Router (v3) used by the Metarouter's cross-chain commands.\n * @dev Hyperlane's `@hyperlane-xyz/core` ships no interface for its `InterchainAccountRouter`; the methods used here\n *      exist only on the concrete contract, which is an upgradeable `^0.8.13` implementation with a large dependency\n *      tree. This minimal interface mirrors that contract's selectors instead of importing it. The `_hook` argument\n *      is typed as `address` because interface types encode as `address` in the function selector, so it matches\n *      Hyperlane's `IPostDispatchHook` parameter without importing it.\n */\ninterface IInterchainAccountRouter {\n  /**\n   * @notice Dispatches a commitment and its reveal to a destination interchain account.\n   * @param _destination Destination Hyperlane domain.\n   * @param _router Destination router address, as bytes32.\n   * @param _ism Destination interchain security module, as bytes32.\n   * @param _hookMetadata Post-dispatch hook metadata for the reveal message.\n   * @param _hook Post-dispatch hook to run after dispatching to the mailbox.\n   * @param _salt User-provided salt controlling account derivation.\n   * @param _commitment Commitment to the destination calls.\n   * @return _commitmentMsgId Hyperlane message id of the commitment message.\n   * @return _revealMsgId Hyperlane message id of the reveal message.\n   */\n  function callRemoteCommitReveal(\n    uint32 _destination,\n    bytes32 _router,\n    bytes32 _ism,\n    bytes calldata _hookMetadata,\n    address _hook,\n    bytes32 _salt,\n    bytes32 _commitment\n  ) external payable returns (bytes32 _commitmentMsgId, bytes32 _revealMsgId);\n\n  /**\n   * @notice Derives the deterministic interchain account owned by `_owner` on `_destination`.\n   * @dev The account is not guaranteed to be deployed; the address depends on the destination router and ISM\n   *      configured for `_destination` and on the user salt.\n   * @param _destination Destination Hyperlane domain.\n   * @param _owner Local owner of the interchain account.\n   * @param _userSalt User-provided salt controlling account derivation.\n   * @return _account Remote address of the interchain account.\n   */\n  function getRemoteInterchainAccount(\n    uint32 _destination,\n    address _owner,\n    bytes32 _userSalt\n  ) external view returns (address _account);\n\n  /**\n   * @notice Derives a deterministic remote interchain account from a custom destination router and ISM.\n   * @dev The account is not guaranteed to be deployed. A zero `_ism` remains part of the account derivation and\n   *      delegates message verification to Hyperlane's default ISM.\n   * @param _owner Local owner of the interchain account.\n   * @param _router Custom destination interchain account router.\n   * @param _ism Custom destination interchain security module, or zero to use Hyperlane's default verifier.\n   * @param _userSalt User-provided salt controlling account derivation.\n   * @return _account Remote address of the interchain account.\n   */\n  function getRemoteInterchainAccount(\n    address _owner,\n    address _router,\n    address _ism,\n    bytes32 _userSalt\n  ) external view returns (address _account);\n\n  /**\n   * @notice Returns the destination router registered for a domain.\n   * @param _domain Destination Hyperlane domain.\n   * @return _router Destination router address, as bytes32.\n   */\n  function routers(uint32 _domain) external view returns (bytes32 _router);\n\n  /**\n   * @notice Returns the interchain security module registered for a domain.\n   * @param _domain Destination Hyperlane domain.\n   * @return _ism Destination interchain security module, as bytes32.\n   */\n  function isms(uint32 _domain) external view returns (bytes32 _ism);\n\n  /**\n   * @notice Returns the Hyperlane domain of the chain this router runs on.\n   * @return _domain The local domain.\n   */\n  function localDomain() external view returns (uint32 _domain);\n}\n"},"node_modules/@openzeppelin/contracts/utils/math/Math.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Return the 512-bit addition of two uint256.\n     *\n     * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n     */\n    function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        assembly (\"memory-safe\") {\n            low := add(a, b)\n            high := lt(low, a)\n        }\n    }\n\n    /**\n     * @dev Return the 512-bit multiplication of two uint256.\n     *\n     * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n     */\n    function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n        // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n        // variables such that product = high * 2²⁵⁶ + low.\n        assembly (\"memory-safe\") {\n            let mm := mulmod(a, b, not(0))\n            low := mul(a, b)\n            high := sub(sub(mm, low), lt(mm, low))\n        }\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a + b;\n            success = c >= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a - b;\n            success = c <= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a * b;\n            assembly (\"memory-safe\") {\n                // Only true when the multiplication doesn't overflow\n                // (c / a == b) || (a == 0)\n                success := or(eq(div(c, a), b), iszero(a))\n            }\n            // equivalent to: success ? c : 0\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `DIV` opcode returns zero when the denominator is 0.\n                result := div(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `MOD` opcode returns zero when the denominator is 0.\n                result := mod(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryAdd(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n     */\n    function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n        (, uint256 result) = trySub(a, b);\n        return result;\n    }\n\n    /**\n     * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryMul(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Branchless ternary evaluation for `condition ? a : b`. Gas costs are constant.\n     *\n     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n     * However, the compiler may optimize Solidity ternary operations (i.e. `condition ? a : b`) to only compute\n     * one branch when needed, making this function more expensive.\n     */\n    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n        unchecked {\n            // branchless ternary works because:\n            // b ^ (a ^ b) == a\n            // b ^ 0 == b\n            return b ^ ((a ^ b) * SafeCast.toUint(condition));\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a > b, a, b);\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a < b, a, b);\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        unchecked {\n            // (a + b) / 2 can overflow.\n            return (a & b) + (a ^ b) / 2;\n        }\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n\n        // The following calculation ensures accurate ceiling division without overflow.\n        // Since a is non-zero, (a - 1) / b will not overflow.\n        // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n        // but the largest value we can obtain is type(uint256).max - 1, which happens\n        // when a = type(uint256).max and b = 1.\n        unchecked {\n            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n        }\n    }\n\n    /**\n     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     *\n     * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (high == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return low / denominator;\n            }\n\n            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n            if (denominator <= high) {\n                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [high low].\n            uint256 remainder;\n            assembly (\"memory-safe\") {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                high := sub(high, gt(remainder, low))\n                low := sub(low, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly (\"memory-safe\") {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [high low] by twos.\n                low := div(low, twos)\n\n                // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from high into low.\n            low |= high * twos;\n\n            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n            inverse *= 2 - denominator * inverse; // inverse mod 2³²\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n            // is no longer required.\n            result = low * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n    }\n\n    /**\n     * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n            if (high >= 1 << n) {\n                Panic.panic(Panic.UNDER_OVERFLOW);\n            }\n            return (high << (256 - n)) | (low >> n);\n        }\n    }\n\n    /**\n     * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n        return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n    }\n\n    /**\n     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n     *\n     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n     *\n     * If the input value is not inversible, 0 is returned.\n     *\n     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n     */\n    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n        unchecked {\n            if (n == 0) return 0;\n\n            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n            // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n            // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n            // ax + ny = 1\n            // ax = 1 + (-y)n\n            // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n            // If the remainder is 0 the gcd is n right away.\n            uint256 remainder = a % n;\n            uint256 gcd = n;\n\n            // Therefore the initial coefficients are:\n            // ax + ny = gcd(a, n) = n\n            // 0a + 1n = n\n            int256 x = 0;\n            int256 y = 1;\n\n            while (remainder != 0) {\n                uint256 quotient = gcd / remainder;\n\n                (gcd, remainder) = (\n                    // The old remainder is the next gcd to try.\n                    remainder,\n                    // Compute the next remainder.\n                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n                    // where gcd is at most n (capped to type(uint256).max)\n                    gcd - remainder * quotient\n                );\n\n                (x, y) = (\n                    // Increment the coefficient of a.\n                    y,\n                    // Decrement the coefficient of n.\n                    // Can overflow, but the result is casted to uint256 so that the\n                    // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n                    x - y * int256(quotient)\n                );\n            }\n\n            if (gcd != 1) return 0; // No inverse exists.\n            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n        }\n    }\n\n    /**\n     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n     *\n     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n     *\n     * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n     */\n    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n        unchecked {\n            return Math.modExp(a, p - 2, p);\n        }\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n     *\n     * Requirements:\n     * - modulus can't be zero\n     * - underlying staticcall to precompile must succeed\n     *\n     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n     * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n     * interpreted as 0.\n     */\n    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n        (bool success, uint256 result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n     * to operate modulo 0 or if the underlying precompile reverted.\n     *\n     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n     * of a revert, but the result may be incorrectly interpreted as 0.\n     */\n    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n        if (m == 0) return (false, 0);\n        assembly (\"memory-safe\") {\n            let ptr := mload(0x40)\n            // | Offset    | Content    | Content (Hex)                                                      |\n            // |-----------|------------|--------------------------------------------------------------------|\n            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n            // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n            mstore(ptr, 0x20)\n            mstore(add(ptr, 0x20), 0x20)\n            mstore(add(ptr, 0x40), 0x20)\n            mstore(add(ptr, 0x60), b)\n            mstore(add(ptr, 0x80), e)\n            mstore(add(ptr, 0xa0), m)\n\n            // Given the result < m, it's guaranteed to fit in 32 bytes,\n            // so we can use the memory scratch space located at offset 0.\n            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n            result := mload(0x00)\n        }\n    }\n\n    /**\n     * @dev Variant of {modExp} that supports inputs of arbitrary length.\n     */\n    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n        (bool success, bytes memory result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n     */\n    function tryModExp(\n        bytes memory b,\n        bytes memory e,\n        bytes memory m\n    ) internal view returns (bool success, bytes memory result) {\n        if (_zeroBytes(m)) return (false, new bytes(0));\n\n        uint256 mLen = m.length;\n\n        // Encode call args in result and move the free memory pointer\n        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n        assembly (\"memory-safe\") {\n            let dataPtr := add(result, 0x20)\n            // Write result on top of args to avoid allocating extra memory.\n            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n            // Overwrite the length.\n            // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n            mstore(result, mLen)\n            // Set the memory pointer after the returned data.\n            mstore(0x40, add(dataPtr, mLen))\n        }\n    }\n\n    /**\n     * @dev Returns whether the provided byte array is zero.\n     */\n    function _zeroBytes(bytes memory buffer) private pure returns (bool) {\n        uint256 chunk;\n        for (uint256 i = 0; i < buffer.length; i += 0x20) {\n            // See _unsafeReadBytesOffset from utils/Bytes.sol\n            assembly (\"memory-safe\") {\n                chunk := mload(add(add(buffer, 0x20), i))\n            }\n            if (chunk >> (8 * saturatingSub(i + 0x20, buffer.length)) != 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n     * using integer operations.\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        unchecked {\n            // Take care of easy edge cases when a == 0 or a == 1\n            if (a <= 1) {\n                return a;\n            }\n\n            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n            // the current value as `ε_n = | x_n - sqrt(a) |`.\n            //\n            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n            // bigger than any uint256.\n            //\n            // By noticing that\n            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n            // to the msb function.\n            uint256 aa = a;\n            uint256 xn = 1;\n\n            if (aa >= (1 << 128)) {\n                aa >>= 128;\n                xn <<= 64;\n            }\n            if (aa >= (1 << 64)) {\n                aa >>= 64;\n                xn <<= 32;\n            }\n            if (aa >= (1 << 32)) {\n                aa >>= 32;\n                xn <<= 16;\n            }\n            if (aa >= (1 << 16)) {\n                aa >>= 16;\n                xn <<= 8;\n            }\n            if (aa >= (1 << 8)) {\n                aa >>= 8;\n                xn <<= 4;\n            }\n            if (aa >= (1 << 4)) {\n                aa >>= 4;\n                xn <<= 2;\n            }\n            if (aa >= (1 << 2)) {\n                xn <<= 1;\n            }\n\n            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n            //\n            // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n            // This is going to be our x_0 (and ε_0)\n            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n            // From here, Newton's method give us:\n            // x_{n+1} = (x_n + a / x_n) / 2\n            //\n            // One should note that:\n            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n            //              = ((x_n² + a) / (2 * x_n))² - a\n            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n            //              = (x_n² - a)² / (2 * x_n)²\n            //              = ((x_n² - a) / (2 * x_n))²\n            //              ≥ 0\n            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n            //\n            // This gives us the proof of quadratic convergence of the sequence:\n            // ε_{n+1} = | x_{n+1} - sqrt(a) |\n            //         = | (x_n + a / x_n) / 2 - sqrt(a) |\n            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n            //         = | (x_n - sqrt(a))² / (2 * x_n) |\n            //         = | ε_n² / (2 * x_n) |\n            //         = ε_n² / | (2 * x_n) |\n            //\n            // For the first iteration, we have a special case where x_0 is known:\n            // ε_1 = ε_0² / | (2 * x_0) |\n            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))\n            //     ≤ 2**(e-3) / 3\n            //     ≤ 2**(e-3-log2(3))\n            //     ≤ 2**(e-4.5)\n            //\n            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n            // ε_{n+1} = ε_n² / | (2 * x_n) |\n            //         ≤ (2**(e-k))² / (2 * 2**(e-1))\n            //         ≤ 2**(2*e-2*k) / 2**e\n            //         ≤ 2**(e-2*k)\n            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above\n            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5\n            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9\n            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18\n            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36\n            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72\n\n            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n            // sqrt(a) or sqrt(a) + 1.\n            return xn - SafeCast.toUint(xn > a / xn);\n        }\n    }\n\n    /**\n     * @dev Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // If upper 8 bits of 16-bit half set, add 8 to result\n        r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n        // If upper 4 bits of 8-bit half set, add 4 to result\n        r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n        // Shifts value right by the current result and use it as an index into this lookup table:\n        //\n        // | x (4 bits) |  index  | table[index] = MSB position |\n        // |------------|---------|-----------------------------|\n        // |    0000    |    0    |        table[0] = 0         |\n        // |    0001    |    1    |        table[1] = 0         |\n        // |    0010    |    2    |        table[2] = 1         |\n        // |    0011    |    3    |        table[3] = 1         |\n        // |    0100    |    4    |        table[4] = 2         |\n        // |    0101    |    5    |        table[5] = 2         |\n        // |    0110    |    6    |        table[6] = 2         |\n        // |    0111    |    7    |        table[7] = 2         |\n        // |    1000    |    8    |        table[8] = 3         |\n        // |    1001    |    9    |        table[9] = 3         |\n        // |    1010    |   10    |        table[10] = 3        |\n        // |    1011    |   11    |        table[11] = 3        |\n        // |    1100    |   12    |        table[12] = 3        |\n        // |    1101    |   13    |        table[13] = 3        |\n        // |    1110    |   14    |        table[14] = 3        |\n        // |    1111    |   15    |        table[15] = 3        |\n        //\n        // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the first 16 bytes (most significant half).\n        assembly (\"memory-safe\") {\n            r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n        return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n\n    /**\n     * @dev Counts the number of leading zero bits in a uint256.\n     */\n    function clz(uint256 x) internal pure returns (uint256) {\n        return ternary(x == 0, 256, 255 - log2(x));\n    }\n}\n"},"V3/src/interfaces/external/ICrossCollateralTokenRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ITokenRouter} from 'V3/interfaces/external/ITokenRouter.sol';\n\n/**\n * @title ICrossCollateralTokenRouter\n * @notice Hyperlane ERC20 collateral route supporting an explicitly selected destination token router.\n * @dev Mirrors `CrossCollateralRouter` from `@hyperlane-xyz/core@11.3.1` (hyperlane-monorepo commit\n *      `49bdf9c6bd978a56aa308f07170a6e160fdf7469`) without importing it; the pinned 10.1.3 dependency predates it.\n *      The asset router is independent of the final beneficiary and the destination interchain account router.\n */\ninterface ICrossCollateralTokenRouter is ITokenRouter {\n  /**\n   * @notice Transfers collateral to a beneficiary through the selected enrolled destination token router.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Final beneficiary on the destination domain.\n   * @param _amount Amount in source collateral token units.\n   * @param _targetRouter Destination token router receiving the transfer message.\n   * @return _messageId Identifier of the dispatched Hyperlane message.\n   */\n  function transferRemoteTo(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount,\n    bytes32 _targetRouter\n  ) external payable returns (bytes32 _messageId);\n\n  /**\n   * @notice Quotes the collateral and messaging payments for the same explicitly selected route as the transfer.\n   * @param _destination Destination Hyperlane domain.\n   * @param _recipient Final beneficiary on the destination domain.\n   * @param _amount Amount in source collateral token units.\n   * @param _targetRouter Destination token router receiving the transfer message.\n   * @return _quotes Required payments, which may contain multiple entries in the same denomination.\n   */\n  function quoteTransferRemoteTo(\n    uint32 _destination,\n    bytes32 _recipient,\n    uint256 _amount,\n    bytes32 _targetRouter\n  ) external view returns (Quote[] memory _quotes);\n\n  /**\n   * @notice Returns the origin Hyperlane domain used to distinguish remote from synchronous local transfers.\n   * @return _domain Origin Hyperlane domain.\n   */\n  function localDomain() external view returns (uint32 _domain);\n}\n"},"V3/src/interfaces/external/INonfungiblePositionManager.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\n\n/**\n * @title INonfungiblePositionManager\n * @notice Minimal view of the concentrated-liquidity `NonfungiblePositionManager` used by the Metarouter's CL position\n *         commands: the ERC721 custody surface plus mint, liquidity changes, fee collection, burn, and the position\n *         read the handlers need to resolve a position's tokens.\n * @dev The upstream manager ships in the `metadex-slipstream` repo, which is not remapped into this repo, so the\n *      selectors and structs the commands call are mirrored here as one self-contained interface. It inherits `IERC721`\n *      because the manager is an ERC721 and the router uses its custody calls (`ownerOf`, `approve`, `transferFrom`,\n *      `safeTransferFrom`) alongside the position calls. Struct field names and the `positions` tuple are kept verbatim\n *      so they match the manager's ABI.\n */\ninterface INonfungiblePositionManager is IERC721 {\n  /**\n   * @notice Arguments for `mint`.\n   * @param token0 First pool token, sorted ascending.\n   * @param token1 Second pool token, sorted ascending.\n   * @param tickSpacing Tick spacing identifying the pool alongside its tokens.\n   * @param tickLower Lower tick of the position range.\n   * @param tickUpper Upper tick of the position range.\n   * @param amount0Desired Maximum `token0` to contribute.\n   * @param amount1Desired Maximum `token1` to contribute.\n   * @param amount0Min Minimum `token0` to contribute, as a slippage bound.\n   * @param amount1Min Minimum `token1` to contribute, as a slippage bound.\n   * @param recipient Address the minted position is transferred to.\n   * @param deadline Timestamp after which the mint reverts.\n   * @param sqrtPriceX96 Price to initialize the pool with when it does not yet exist; ignored when zero.\n   */\n  struct MintParams {\n    address token0;\n    address token1;\n    int24 tickSpacing;\n    int24 tickLower;\n    int24 tickUpper;\n    uint256 amount0Desired;\n    uint256 amount1Desired;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    address recipient;\n    uint256 deadline;\n    uint160 sqrtPriceX96;\n  }\n\n  /**\n   * @notice Arguments for `increaseLiquidity`.\n   * @param tokenId Position to add liquidity to.\n   * @param amount0Desired Maximum `token0` to contribute.\n   * @param amount1Desired Maximum `token1` to contribute.\n   * @param amount0Min Minimum `token0` to contribute, as a slippage bound.\n   * @param amount1Min Minimum `token1` to contribute, as a slippage bound.\n   * @param deadline Timestamp after which the increase reverts.\n   */\n  struct IncreaseLiquidityParams {\n    uint256 tokenId;\n    uint256 amount0Desired;\n    uint256 amount1Desired;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Arguments for `decreaseLiquidity`.\n   * @param tokenId Position to remove liquidity from.\n   * @param liquidity Liquidity to remove, accounted to the position's owed tokens.\n   * @param amount0Min Minimum `token0` accounted, as a slippage bound.\n   * @param amount1Min Minimum `token1` accounted, as a slippage bound.\n   * @param deadline Timestamp after which the decrease reverts.\n   */\n  struct DecreaseLiquidityParams {\n    uint256 tokenId;\n    uint128 liquidity;\n    uint256 amount0Min;\n    uint256 amount1Min;\n    uint256 deadline;\n  }\n\n  /**\n   * @notice Arguments for `collect`.\n   * @param tokenId Position whose owed tokens are collected.\n   * @param recipient Address receiving the collected tokens.\n   * @param amount0Max Maximum `token0` to collect.\n   * @param amount1Max Maximum `token1` to collect.\n   */\n  struct CollectParams {\n    uint256 tokenId;\n    address recipient;\n    uint128 amount0Max;\n    uint128 amount1Max;\n  }\n\n  /**\n   * @notice Creates a new position wrapped in an NFT.\n   * @param params Mint arguments encoded as `MintParams`.\n   * @return tokenId Id of the minted position.\n   * @return liquidity Liquidity of the minted position.\n   * @return amount0 `token0` contributed.\n   * @return amount1 `token1` contributed.\n   */\n  function mint(MintParams calldata params)\n    external\n    payable\n    returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Adds liquidity to an existing position, paid by the caller.\n   * @param params Increase arguments encoded as `IncreaseLiquidityParams`.\n   * @return liquidity Liquidity added to the position.\n   * @return amount0 `token0` contributed.\n   * @return amount1 `token1` contributed.\n   */\n  function increaseLiquidity(IncreaseLiquidityParams calldata params)\n    external\n    payable\n    returns (uint128 liquidity, uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Removes liquidity from a position, accounting it to the position's owed tokens.\n   * @param params Decrease arguments encoded as `DecreaseLiquidityParams`.\n   * @return amount0 `token0` accounted to the position's owed tokens.\n   * @return amount1 `token1` accounted to the position's owed tokens.\n   */\n  function decreaseLiquidity(DecreaseLiquidityParams calldata params)\n    external\n    payable\n    returns (uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Collects owed tokens from a position to the recipient.\n   * @param params Collect arguments encoded as `CollectParams`.\n   * @return amount0 `token0` collected.\n   * @return amount1 `token1` collected.\n   */\n  function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);\n\n  /**\n   * @notice Burns a position, which must hold no liquidity and no owed tokens.\n   * @param tokenId Position to burn.\n   */\n  function burn(uint256 tokenId) external payable;\n\n  /**\n   * @notice Returns the position associated with a token id.\n   * @param tokenId Position to read.\n   * @return nonce Permit nonce.\n   * @return operator Approved operator for the position.\n   * @return token0 First pool token.\n   * @return token1 Second pool token.\n   * @return tickSpacing Tick spacing of the pool.\n   * @return tickLower Lower tick of the position range.\n   * @return tickUpper Upper tick of the position range.\n   * @return liquidity Liquidity held by the position.\n   * @return feeGrowthInside0LastX128 `token0` fee growth snapshot at the last position action.\n   * @return feeGrowthInside1LastX128 `token1` fee growth snapshot at the last position action.\n   * @return tokensOwed0 Uncollected `token0` owed to the position.\n   * @return tokensOwed1 Uncollected `token1` owed to the position.\n   */\n  function positions(uint256 tokenId)\n    external\n    view\n    returns (\n      uint96 nonce,\n      address operator,\n      address token0,\n      address token1,\n      int24 tickSpacing,\n      int24 tickLower,\n      int24 tickUpper,\n      uint128 liquidity,\n      uint256 feeGrowthInside0LastX128,\n      uint256 feeGrowthInside1LastX128,\n      uint128 tokensOwed0,\n      uint128 tokensOwed1\n    );\n\n  /**\n   * @notice Returns the CL factory whose pools this manager issues positions for.\n   * @dev Immutable upstream, and the reverse of `ICLFactory.positionManager`; the router authenticates a resolved\n   *      manager by requiring this to point back at the factory it came from.\n   * @return The concentrated-liquidity factory.\n   */\n  function factory() external view returns (address);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC721.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC721.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC721} from \"../token/ERC721/IERC721.sol\";\n"},"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"},"V3/src/interfaces/access/IGuardedAccessControlEnumerable.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @title GuardedAccessControlEnumerable interface\n/// @notice Shared surface for AccessControlEnumerable extensions that block orphaning a self-administering role.\ninterface IGuardedAccessControlEnumerable {\n  /// @notice Thrown when revoking or renouncing would remove the last holder of a self-administering role,\n  ///         permanently freezing that role.\n  /// @param role Role whose last holder cannot be removed.\n  error LastRoleHolder(bytes32 role);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n    /*\n     * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n     * 0xb0202a11 ===\n     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n     */\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @param data Additional data with no specified format, sent in call to `spender`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC4906.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC4906.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"./IERC165.sol\";\nimport {IERC721} from \"./IERC721.sol\";\n\n/// @title ERC-721 Metadata Update Extension\ninterface IERC4906 is IERC165, IERC721 {\n    /// @dev This event emits when the metadata of a token is changed.\n    /// So that the third-party platforms such as NFT market could\n    /// timely update the images and related attributes of the NFT.\n    event MetadataUpdate(uint256 _tokenId);\n\n    /// @dev This event emits when the metadata of a range of tokens is changed.\n    /// So that the third-party platforms such as NFT market could\n    /// timely update the images and related attributes of the NFTs.\n    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n}\n"},"node_modules/@openzeppelin/contracts/interfaces/IERC6372.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC6372.sol)\n\npragma solidity >=0.4.16;\n\ninterface IERC6372 {\n    /**\n     * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).\n     */\n    function clock() external view returns (uint48);\n\n    /**\n     * @dev Description of the clock\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function CLOCK_MODE() external view returns (string memory);\n}\n"},"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n    /**\n     * @dev Value doesn't fit in a uint of `bits` size.\n     */\n    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n    /**\n     * @dev An int value doesn't fit in a uint of `bits` size.\n     */\n    error SafeCastOverflowedIntToUint(int256 value);\n\n    /**\n     * @dev Value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n    /**\n     * @dev A uint value doesn't fit in an int of `bits` size.\n     */\n    error SafeCastOverflowedUintToInt(uint256 value);\n\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        if (value > type(uint248).max) {\n            revert SafeCastOverflowedUintDowncast(248, value);\n        }\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        if (value > type(uint240).max) {\n            revert SafeCastOverflowedUintDowncast(240, value);\n        }\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        if (value > type(uint232).max) {\n            revert SafeCastOverflowedUintDowncast(232, value);\n        }\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        if (value > type(uint224).max) {\n            revert SafeCastOverflowedUintDowncast(224, value);\n        }\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        if (value > type(uint216).max) {\n            revert SafeCastOverflowedUintDowncast(216, value);\n        }\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        if (value > type(uint208).max) {\n            revert SafeCastOverflowedUintDowncast(208, value);\n        }\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        if (value > type(uint200).max) {\n            revert SafeCastOverflowedUintDowncast(200, value);\n        }\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        if (value > type(uint192).max) {\n            revert SafeCastOverflowedUintDowncast(192, value);\n        }\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        if (value > type(uint184).max) {\n            revert SafeCastOverflowedUintDowncast(184, value);\n        }\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        if (value > type(uint176).max) {\n            revert SafeCastOverflowedUintDowncast(176, value);\n        }\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        if (value > type(uint168).max) {\n            revert SafeCastOverflowedUintDowncast(168, value);\n        }\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        if (value > type(uint160).max) {\n            revert SafeCastOverflowedUintDowncast(160, value);\n        }\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        if (value > type(uint152).max) {\n            revert SafeCastOverflowedUintDowncast(152, value);\n        }\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        if (value > type(uint144).max) {\n            revert SafeCastOverflowedUintDowncast(144, value);\n        }\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        if (value > type(uint136).max) {\n            revert SafeCastOverflowedUintDowncast(136, value);\n        }\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        if (value > type(uint128).max) {\n            revert SafeCastOverflowedUintDowncast(128, value);\n        }\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        if (value > type(uint120).max) {\n            revert SafeCastOverflowedUintDowncast(120, value);\n        }\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        if (value > type(uint112).max) {\n            revert SafeCastOverflowedUintDowncast(112, value);\n        }\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        if (value > type(uint104).max) {\n            revert SafeCastOverflowedUintDowncast(104, value);\n        }\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        if (value > type(uint96).max) {\n            revert SafeCastOverflowedUintDowncast(96, value);\n        }\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        if (value > type(uint88).max) {\n            revert SafeCastOverflowedUintDowncast(88, value);\n        }\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        if (value > type(uint80).max) {\n            revert SafeCastOverflowedUintDowncast(80, value);\n        }\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        if (value > type(uint72).max) {\n            revert SafeCastOverflowedUintDowncast(72, value);\n        }\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SafeCastOverflowedUintDowncast(64, value);\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        if (value > type(uint56).max) {\n            revert SafeCastOverflowedUintDowncast(56, value);\n        }\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert SafeCastOverflowedUintDowncast(48, value);\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert SafeCastOverflowedUintDowncast(40, value);\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert SafeCastOverflowedUintDowncast(32, value);\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        if (value > type(uint24).max) {\n            revert SafeCastOverflowedUintDowncast(24, value);\n        }\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        if (value > type(uint16).max) {\n            revert SafeCastOverflowedUintDowncast(16, value);\n        }\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        if (value > type(uint8).max) {\n            revert SafeCastOverflowedUintDowncast(8, value);\n        }\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        if (value < 0) {\n            revert SafeCastOverflowedIntToUint(value);\n        }\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(248, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(240, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(232, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(224, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(216, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(208, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(200, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(192, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(184, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(176, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(168, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(160, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(152, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(144, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(136, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(128, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(120, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(112, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(104, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(96, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(88, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(80, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(72, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(64, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(56, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(48, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(40, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(32, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(24, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(16, value);\n        }\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        if (downcasted != value) {\n            revert SafeCastOverflowedIntDowncast(8, value);\n        }\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        if (value > uint256(type(int256).max)) {\n            revert SafeCastOverflowedUintToInt(value);\n        }\n        return int256(value);\n    }\n\n    /**\n     * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n     */\n    function toUint(bool b) internal pure returns (uint256 u) {\n        assembly (\"memory-safe\") {\n            u := iszero(iszero(b))\n        }\n    }\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC-721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n     *   {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the address zero.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"},"node_modules/@openzeppelin/contracts/access/IAccessControl.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)\n\npragma solidity >=0.8.4;\n\n/**\n * @dev External interface of AccessControl declared to support ERC-165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev The `account` is missing a role.\n     */\n    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n    /**\n     * @dev The caller of a function is not the expected one.\n     *\n     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n     */\n    error AccessControlBadConfirmation();\n\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted to signal this.\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).\n     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    /**\n     * @dev An operation with an ERC-20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        if (!_safeTransfer(token, to, value, true)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        if (!_safeTransferFrom(token, from, to, value, true)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n        return _safeTransfer(token, to, value, false);\n    }\n\n    /**\n     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n        return _safeTransferFrom(token, from, to, value, false);\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     *\n     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     *\n     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n     * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n     * set here.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        if (!_safeApprove(token, spender, value, false)) {\n            if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));\n            if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            safeTransfer(token, to, value);\n        } else if (!token.transferAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n     * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferFromAndCallRelaxed(\n        IERC1363 token,\n        address from,\n        address to,\n        uint256 value,\n        bytes memory data\n    ) internal {\n        if (to.code.length == 0) {\n            safeTransferFrom(token, from, to, value);\n        } else if (!token.transferFromAndCall(from, to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n     * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n     * once without retrying, and relies on the returned value to be true.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            forceApprove(token, to, value);\n        } else if (!token.approveAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n     * return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param to The recipient of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {\n        bytes4 selector = IERC20.transfer.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(to, shr(96, not(0))))\n            mstore(0x24, value)\n            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n     * value: the return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param from The sender of the tokens\n     * @param to The recipient of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value,\n        bool bubble\n    ) private returns (bool success) {\n        bytes4 selector = IERC20.transferFrom.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(from, shr(96, not(0))))\n            mstore(0x24, and(to, shr(96, not(0))))\n            mstore(0x44, value)\n            success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n            mstore(0x60, 0)\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n     * the return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param spender The spender of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {\n        bytes4 selector = IERC20.approve.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(spender, shr(96, not(0))))\n            mstore(0x24, value)\n            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n        }\n    }\n}\n"},"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity >=0.5.0;\n\n/**\n * @title ERC-721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC-721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n     * reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also applies here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n    /**\n     * @dev Returns the total amount of tokens stored by the contract.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n     */\n    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n    /**\n     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n     * Use along with {totalSupply} to enumerate all tokens.\n     */\n    function tokenByIndex(uint256 index) external view returns (uint256);\n}\n"}},"language":"Solidity","settings":{"viaIR":false,"metadata":{"appendCBOR":true,"bytecodeHash":"ipfs","useLiteralContent":false},"libraries":{"V3/src/metarouter/Metarouter.sol":{"ClaimsLib":"0x8eda4655fd8e6bb3aff3d3f36610b1efec24aa22","StakingLib":"0xe463e88df582c0b7a6d530f85c2c6954fb4f3c00","PaymentsLib":"0xa37042e33c31e41b74bf18f0c1b27000f10e9e13","LiquidityLib":"0x0028a78d20d2d5d230cc4b2a23b90793a95cb691","ClPositionLib":"0x96fa373a6d7930d67accf441529ccf3477405493","CrosschainLib":"0x47a3b182d028d503a6e6cd2bd1b4c11960d12113","StakeRelayLib":"0xff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e"}},"optimizer":{"runs":10000,"enabled":true},"viaSSACFG":false,"evmVersion":"prague","remappings":["forge-std/=node_modules/forge-std/src/","@hyperlane/contracts/=node_modules/@hyperlane-xyz/core/contracts/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable-v4/","node_modules/@hyperlane-xyz/:@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable-v4/","@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/","@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/","@openzeppelin4/contracts/=node_modules/@openzeppelin/contracts-v4/","@solady/=node_modules/solady/src/","@nomad-xyz/src/=node_modules/@nomad-xyz/excessively-safe-call/src/","V3/=V3/src/","V3-script/=V3/script/","V3-test/=V3/test/"],"experimental":false}},"stdJsonOutput":{"sources":{"V3/src/metarouter/Metarouter.sol":{"id":41},"V3/src/interfaces/core/IVotes.sol":{"id":5},"V3/src/interfaces/pools/IPool.sol":{"id":24},"V3/src/interfaces/relay/IRelay.sol":{"id":26},"V3/src/interfaces/token/IToken.sol":{"id":34},"V3/src/interfaces/voter/IVoter.sol":{"id":37},"V3/src/interfaces/gauges/IGauge.sol":{"id":18},"V3/src/interfaces/pools/ICLPool.sol":{"id":23},"V3/src/interfaces/external/IWETH.sol":{"id":11},"V3/src/interfaces/minter/IMinter.sol":{"id":22},"V3/src/interfaces/gauges/ICLGauge.sol":{"id":17},"V3/src/interfaces/gauges/IV2Gauge.sol":{"id":19},"V3/src/interfaces/voter/ILeafVoter.sol":{"id":36},"V3/src/libraries/ProtocolConstants.sol":{"id":40},"V3/src/interfaces/relay/IRelayState.sol":{"id":29},"V3/src/interfaces/relay/IRelayToken.sol":{"id":30},"V3/src/metarouter/TransientTracking.sol":{"id":42},"V3/src/interfaces/core/IVotingEscrow.sol":{"id":6},"V3/src/interfaces/governor/IGovernor.sol":{"id":20},"V3/src/interfaces/voter/IVoterCommon.sol":{"id":38},"V3/src/metarouter/libraries/Commands.sol":{"id":46},"V3/src/metarouter/libraries/FundsLib.sol":{"id":48},"V3/src/metarouter/libraries/GaugeLib.sol":{"id":49},"V3/src/interfaces/relay/IRelayFactory.sol":{"id":27},"V3/src/metarouter/libraries/ClaimsLib.sol":{"id":45},"V3/src/metarouter/libraries/V2PoolLib.sol":{"id":56},"V3/src/interfaces/factories/ICLFactory.sol":{"id":12},"V3/src/interfaces/pools/tape/IPoolTape.sol":{"id":25},"V3/src/metarouter/libraries/StakingLib.sol":{"id":54},"V3/src/interfaces/external/ITokenRouter.sol":{"id":10},"V3/src/metarouter/libraries/PaymentsLib.sol":{"id":52},"V3/src/interfaces/bridge/IMessageAdapter.sol":{"id":2},"V3/src/interfaces/factories/IPoolFactory.sol":{"id":16},"V3/src/interfaces/metarouter/IMetarouter.sol":{"id":21},"V3/src/interfaces/token/ITokenExtensions.sol":{"id":35},"V3/src/metarouter/libraries/LiquidityLib.sol":{"id":50},"V3/src/interfaces/factories/IGaugeFactory.sol":{"id":15},"V3/src/interfaces/relay/IRelayVoteAdapter.sol":{"id":31},"V3/src/metarouter/libraries/ClPositionLib.sol":{"id":43},"V3/src/metarouter/libraries/ClResolverLib.sol":{"id":44},"V3/src/metarouter/libraries/CrosschainLib.sol":{"id":47},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"id":53},"V3/src/interfaces/vpm/IVoterPaymentsModule.sol":{"id":39},"V3/src/metarouter/libraries/TokenRouterLib.sol":{"id":55},"V3/src/interfaces/factories/ICLGaugeFactory.sol":{"id":13},"V3/src/metarouter/libraries/MetarouterState.sol":{"id":51},"V3/src/interfaces/factories/IFactoryRegistry.sol":{"id":14},"V3/src/interfaces/token/IBaseTokenExtensions.sol":{"id":32},"V3/src/interfaces/bridge/IMessageOrchestrator.sol":{"id":3},"V3/src/interfaces/relay/IRelayFactoryRegistry.sol":{"id":28},"V3/src/interfaces/token/IReceiptTokenExtensions.sol":{"id":33},"node_modules/@openzeppelin/contracts/utils/Panic.sol":{"id":72},"V3/src/interfaces/bridge/ILeafMessageOrchestrator.sol":{"id":1},"V3/src/interfaces/bridge/IRootMessageOrchestrator.sol":{"id":4},"V3/src/interfaces/external/IInterchainAccountRouter.sol":{"id":8},"node_modules/@openzeppelin/contracts/utils/math/Math.sol":{"id":74},"V3/src/interfaces/external/ICrossCollateralTokenRouter.sol":{"id":7},"V3/src/interfaces/external/INonfungiblePositionManager.sol":{"id":9},"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol":{"id":60},"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol":{"id":59},"node_modules/@openzeppelin/contracts/interfaces/IERC721.sol":{"id":63},"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol":{"id":64},"V3/src/interfaces/access/IGuardedAccessControlEnumerable.sol":{"id":0},"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol":{"id":58},"node_modules/@openzeppelin/contracts/interfaces/IERC4906.sol":{"id":61},"node_modules/@openzeppelin/contracts/interfaces/IERC6372.sol":{"id":62},"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol":{"id":75},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol":{"id":68},"node_modules/@openzeppelin/contracts/access/IAccessControl.sol":{"id":57},"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"id":67},"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol":{"id":73},"node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol":{"id":69},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol":{"id":66},"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"id":65},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol":{"id":71},"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol":{"id":70}},"contracts":{"V3/src/metarouter/Metarouter.sol":{"Metarouter":{"abi":[{"type":"constructor","inputs":[{"name":"_weth","type":"address","internalType":"contract IWETH"},{"name":"_leafVoter","type":"address","internalType":"contract ILeafVoter"},{"name":"_rootVoter","type":"address","internalType":"contract IVoter"},{"name":"_icaRouter","type":"address","internalType":"contract IInterchainAccountRouter"},{"name":"_relayFactoryRegistry","type":"address","internalType":"contract IRelayFactoryRegistry"},{"name":"_factoryRegistry","type":"address","internalType":"contract IFactoryRegistry"},{"name":"_nativeErc20","type":"address","internalType":"contract IERC20"}],"stateMutability":"nonpayable"},{"name":"AmountOverflow","type":"error","inputs":[]},{"name":"BatchNotActive","type":"error","inputs":[]},{"name":"BridgeQuoteExceedsBudget","type":"error","inputs":[{"name":"_quote","type":"uint256","internalType":"uint256"},{"name":"_budget","type":"uint256","internalType":"uint256"}]},{"name":"BridgeTokenMismatch","type":"error","inputs":[]},{"name":"CallbackNotCleared","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"CommandDisabled","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"ContractLocked","type":"error","inputs":[]},{"name":"DirectCallRequired","type":"error","inputs":[]},{"name":"Expired","type":"error","inputs":[]},{"name":"FactoryNotApproved","type":"error","inputs":[]},{"name":"GaugeFactoryMismatch","type":"error","inputs":[{"name":"_gauge","type":"address","internalType":"address"},{"name":"_recordedFactory","type":"address","internalType":"address"},{"name":"_reportedFactory","type":"address","internalType":"address"}]},{"name":"GaugeNotRegistered","type":"error","inputs":[]},{"name":"InFlightNftPresent","type":"error","inputs":[]},{"name":"InsufficientAmount0","type":"error","inputs":[]},{"name":"InsufficientAmount1","type":"error","inputs":[]},{"name":"InsufficientAmountA","type":"error","inputs":[]},{"name":"InsufficientAmountB","type":"error","inputs":[]},{"name":"InsufficientBalance","type":"error","inputs":[{"name":"_asset","type":"address","internalType":"address"}]},{"name":"InsufficientLiquidityMinted","type":"error","inputs":[{"name":"_minimum","type":"uint256","internalType":"uint256"},{"name":"_minted","type":"uint256","internalType":"uint256"}]},{"name":"InvalidAmountOut","type":"error","inputs":[]},{"name":"InvalidBridgeQuote","type":"error","inputs":[]},{"name":"InvalidCallbackCaller","type":"error","inputs":[{"name":"_caller","type":"address","internalType":"address"}]},{"name":"InvalidCallbackDeltas","type":"error","inputs":[]},{"name":"InvalidCommandType","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"InvalidEthSender","type":"error","inputs":[]},{"name":"InvalidGaugeType","type":"error","inputs":[]},{"name":"InvalidHookMetadata","type":"error","inputs":[]},{"name":"InvalidInterchainAccountConfig","type":"error","inputs":[]},{"name":"InvalidNativeErc20Decimals","type":"error","inputs":[]},{"name":"InvalidNftSender","type":"error","inputs":[]},{"name":"InvalidPath","type":"error","inputs":[]},{"name":"InvalidPayer","type":"error","inputs":[]},{"name":"InvalidPips","type":"error","inputs":[{"name":"_pips","type":"uint256","internalType":"uint256"}]},{"name":"InvalidPool","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"InvalidRecipient","type":"error","inputs":[]},{"name":"InvalidReserves","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"InvalidSpendMode","type":"error","inputs":[]},{"name":"InvalidSwapDeltas","type":"error","inputs":[]},{"name":"LengthMismatch","type":"error","inputs":[]},{"name":"NativeBalanceNotCleared","type":"error","inputs":[]},{"name":"NativeTransferFailed","type":"error","inputs":[{"name":"_data","type":"bytes","internalType":"bytes"}]},{"name":"NftNotCleared","type":"error","inputs":[]},{"name":"NftNotInCustody","type":"error","inputs":[]},{"name":"NftNotReceived","type":"error","inputs":[]},{"name":"NftSenderNotCleared","type":"error","inputs":[]},{"name":"NoInFlightNft","type":"error","inputs":[]},{"name":"NotLeaf","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"NotPositionOwner","type":"error","inputs":[]},{"name":"NotRoot","type":"error","inputs":[{"name":"_commandType","type":"uint256","internalType":"uint256"}]},{"name":"PenaltyNotAccepted","type":"error","inputs":[]},{"name":"PoolNotFound","type":"error","inputs":[]},{"name":"PoolNotRegistered","type":"error","inputs":[]},{"name":"PoolTokenMismatch","type":"error","inputs":[{"name":"_pool","type":"address","internalType":"address"}]},{"name":"PositionManagerFactoryMismatch","type":"error","inputs":[{"name":"_factory","type":"address","internalType":"address"},{"name":"_positionManager","type":"address","internalType":"address"}]},{"name":"PositionManagerNotConfigured","type":"error","inputs":[{"name":"_factory","type":"address","internalType":"address"}]},{"name":"PreBatchNativeBalanceSpent","type":"error","inputs":[]},{"name":"SafeERC20FailedOperation","type":"error","inputs":[{"name":"token","type":"address","internalType":"address"}]},{"name":"SameDomainCrossCollateralTransfer","type":"error","inputs":[]},{"name":"TokenFeeExceedsAmount","type":"error","inputs":[]},{"name":"TokenFeeExceedsMax","type":"error","inputs":[]},{"name":"TooLittleReceived","type":"error","inputs":[{"name":"_minimum","type":"uint256","internalType":"uint256"},{"name":"_received","type":"uint256","internalType":"uint256"}]},{"name":"TooMuchRequested","type":"error","inputs":[]},{"name":"UnauthorizedRelay","type":"error","inputs":[]},{"name":"UnauthorizedRelayVpm","type":"error","inputs":[]},{"name":"UnexpectedNftSender","type":"error","inputs":[]},{"name":"UnregisteredDomain","type":"error","inputs":[]},{"name":"UnsupportedBridgeFeeToken","type":"error","inputs":[{"name":"_token","type":"address","internalType":"address"}]},{"name":"UnsupportedCrossCollateralToken","type":"error","inputs":[]},{"name":"WethIsNativeErc20","type":"error","inputs":[]},{"name":"ZeroAddress","type":"error","inputs":[]},{"name":"ZeroAmount","type":"error","inputs":[]},{"name":"BatchExecuted","type":"event","inputs":[{"name":"_sender","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"name":"EMISSION_TOKEN","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IERC20"}],"stateMutability":"view"},{"name":"FACTORY_REGISTRY","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IFactoryRegistry"}],"stateMutability":"view"},{"name":"ICA_ROUTER","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IInterchainAccountRouter"}],"stateMutability":"view"},{"name":"IS_ROOT","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"LEAF_VOTER","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract ILeafVoter"}],"stateMutability":"view"},{"name":"NATIVE_ERC20","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IERC20"}],"stateMutability":"view"},{"name":"NATIVE_ERC20_SCALE","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"name":"RELAY_FACTORY_REGISTRY","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IRelayFactoryRegistry"}],"stateMutability":"view"},{"name":"STAKING_ESCROW","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IVotingEscrow"}],"stateMutability":"view"},{"name":"STAKING_TOKEN","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IERC20"}],"stateMutability":"view"},{"name":"WETH","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"contract IWETH"}],"stateMutability":"view"},{"name":"execute","type":"function","inputs":[{"name":"_commands","type":"bytes","internalType":"bytes"},{"name":"_inputs","type":"bytes[]","internalType":"bytes[]"},{"name":"_deadline","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"msgSender","type":"function","inputs":[],"outputs":[{"name":"_sender","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"onERC721Received","type":"function","inputs":[{"name":"","type":"address","internalType":"address"},{"name":"_from","type":"address","internalType":"address"},{"name":"_tokenId","type":"uint256","internalType":"uint256"},{"name":"","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"_selector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"name":"uniswapV3SwapCallback","type":"function","inputs":[{"name":"_amount0Delta","type":"int256","internalType":"int256"},{"name":"_amount1Delta","type":"int256","internalType":"int256"},{"name":"_data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"receive","stateMutability":"payable"}],"metadata":"{\"compiler\":{\"version\":\"0.8.36+commit.8a079791\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IWETH\",\"name\":\"_weth\",\"type\":\"address\"},{\"internalType\":\"contract ILeafVoter\",\"name\":\"_leafVoter\",\"type\":\"address\"},{\"internalType\":\"contract IVoter\",\"name\":\"_rootVoter\",\"type\":\"address\"},{\"internalType\":\"contract IInterchainAccountRouter\",\"name\":\"_icaRouter\",\"type\":\"address\"},{\"internalType\":\"contract IRelayFactoryRegistry\",\"name\":\"_relayFactoryRegistry\",\"type\":\"address\"},{\"internalType\":\"contract IFactoryRegistry\",\"name\":\"_factoryRegistry\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"_nativeErc20\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AmountOverflow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BatchNotActive\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_quote\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_budget\",\"type\":\"uint256\"}],\"name\":\"BridgeQuoteExceedsBudget\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BridgeTokenMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"CallbackNotCleared\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_commandType\",\"type\":\"uint256\"}],\"name\":\"CommandDisabled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ContractLocked\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DirectCallRequired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Expired\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FactoryNotApproved\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_gauge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_recordedFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_reportedFactory\",\"type\":\"address\"}],\"name\":\"GaugeFactoryMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"GaugeNotRegistered\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InFlightNftPresent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientAmount0\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientAmount1\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientAmountA\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InsufficientAmountB\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_asset\",\"type\":\"address\"}],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minimum\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minted\",\"type\":\"uint256\"}],\"name\":\"InsufficientLiquidityMinted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBridgeQuote\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"InvalidCallbackCaller\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidCallbackDeltas\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_commandType\",\"type\":\"uint256\"}],\"name\":\"InvalidCommandType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidEthSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidGaugeType\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidHookMetadata\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInterchainAccountConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNativeErc20Decimals\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidNftSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPath\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPayer\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_pips\",\"type\":\"uint256\"}],\"name\":\"InvalidPips\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"InvalidPool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRecipient\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"InvalidReserves\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSpendMode\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSwapDeltas\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"LengthMismatch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NativeBalanceNotCleared\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"NativeTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NftNotCleared\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NftNotInCustody\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NftNotReceived\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NftSenderNotCleared\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoInFlightNft\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_commandType\",\"type\":\"uint256\"}],\"name\":\"NotLeaf\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotPositionOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_commandType\",\"type\":\"uint256\"}],\"name\":\"NotRoot\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PenaltyNotAccepted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PoolNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PoolNotRegistered\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_pool\",\"type\":\"address\"}],\"name\":\"PoolTokenMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_positionManager\",\"type\":\"address\"}],\"name\":\"PositionManagerFactoryMismatch\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_factory\",\"type\":\"address\"}],\"name\":\"PositionManagerNotConfigured\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PreBatchNativeBalanceSpent\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SameDomainCrossCollateralTransfer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenFeeExceedsAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenFeeExceedsMax\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minimum\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_received\",\"type\":\"uint256\"}],\"name\":\"TooLittleReceived\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooMuchRequested\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnauthorizedRelay\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnauthorizedRelayVpm\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnexpectedNftSender\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnregisteredDomain\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"UnsupportedBridgeFeeToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UnsupportedCrossCollateralToken\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WethIsNativeErc20\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"}],\"name\":\"BatchExecuted\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"EMISSION_TOKEN\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FACTORY_REGISTRY\",\"outputs\":[{\"internalType\":\"contract IFactoryRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ICA_ROUTER\",\"outputs\":[{\"internalType\":\"contract IInterchainAccountRouter\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"IS_ROOT\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"LEAF_VOTER\",\"outputs\":[{\"internalType\":\"contract ILeafVoter\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NATIVE_ERC20\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NATIVE_ERC20_SCALE\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAY_FACTORY_REGISTRY\",\"outputs\":[{\"internalType\":\"contract IRelayFactoryRegistry\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKING_ESCROW\",\"outputs\":[{\"internalType\":\"contract IVotingEscrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"STAKING_TOKEN\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WETH\",\"outputs\":[{\"internalType\":\"contract IWETH\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_commands\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"_inputs\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256\",\"name\":\"_deadline\",\"type\":\"uint256\"}],\"name\":\"execute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"msgSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"_selector\",\"type\":\"bytes4\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"_amount0Delta\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"_amount1Delta\",\"type\":\"int256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"uniswapV3SwapCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"Virtual functions allow future variants to inherit from this contract and override selected behavior.\",\"errors\":{\"BridgeQuoteExceedsBudget(uint256,uint256)\":[{\"params\":{\"_budget\":\"Native budget resolved for the bridge.\",\"_quote\":\"Native total the route quotes for the reduced bridge amount.\"}}],\"CallbackNotCleared(address)\":[{\"params\":{\"_pool\":\"Pool still stored as the expected callback caller.\"}}],\"CommandDisabled(uint256)\":[{\"params\":{\"_commandType\":\"Command ID that is disabled on this deployment.\"}}],\"GaugeFactoryMismatch(address,address,address)\":[{\"params\":{\"_gauge\":\"Gauge whose factory identity is inconsistent.\",\"_recordedFactory\":\"Gauge factory recorded by the FactoryRegistry.\",\"_reportedFactory\":\"Gauge factory reported by the gauge itself.\"}}],\"InsufficientBalance(address)\":[{\"params\":{\"_asset\":\"ERC20 address, or address(0) for native ETH.\"}}],\"InsufficientLiquidityMinted(uint256,uint256)\":[{\"params\":{\"_minimum\":\"Minimum LP tokens requested by the caller.\",\"_minted\":\"LP tokens minted by the pool.\"}}],\"InvalidCallbackCaller(address)\":[{\"params\":{\"_caller\":\"Unauthorized callback caller.\"}}],\"InvalidCommandType(uint256)\":[{\"params\":{\"_commandType\":\"Undefined command ID that was dispatched.\"}}],\"InvalidPips(uint256)\":[{\"params\":{\"_pips\":\"Pip value that exceeded the 100% denominator.\"}}],\"InvalidPool(address)\":[{\"params\":{\"_pool\":\"Invalid pool address.\"}}],\"InvalidReserves(address)\":[{\"params\":{\"_pool\":\"Pool with invalid reserves.\"}}],\"NativeTransferFailed(bytes)\":[{\"params\":{\"_data\":\"Revert data returned by the failed low-level call.\"}}],\"NotLeaf(uint256)\":[{\"params\":{\"_commandType\":\"Command ID that is leaf-only.\"}}],\"NotRoot(uint256)\":[{\"params\":{\"_commandType\":\"Command ID that is root-only.\"}}],\"PoolTokenMismatch(address)\":[{\"params\":{\"_pool\":\"Resolved pool address.\"}}],\"PositionManagerFactoryMismatch(address,address)\":[{\"params\":{\"_factory\":\"Factory that named the manager.\",\"_positionManager\":\"Position manager that failed the reverse-link check.\"}}],\"PositionManagerNotConfigured(address)\":[{\"params\":{\"_factory\":\"Factory whose position manager is unset.\"}}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}],\"TooLittleReceived(uint256,uint256)\":[{\"params\":{\"_minimum\":\"Minimum output requested.\",\"_received\":\"Actual output received.\"}}],\"UnsupportedBridgeFeeToken(address)\":[{\"params\":{\"_token\":\"Address of the unsupported fee token.\"}}]},\"events\":{\"BatchExecuted(address)\":{\"params\":{\"_sender\":\"Logical sender that owned the completed batch.\"}}},\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"The emission token and the staking escrow are derived from the protocol, not passed. On root (this chain      equals the leaf voter's orchestrator `ROOT_CHAIN_ID`) the emission token is the root Voter's `MINTER().TOKEN()`      and the staking escrow is the root Voter's `VOTING_ESCROW()`, the canonical escrow `CREATE_STAKE` and      `DEPOSIT_RELAY` act on; on leaf the emission token is the leaf voter's `RECEIPT_TOKEN` and the staking      immutables stay zero. Derived values come from protocol contracts that validate them at their own      construction, so only the constructor's own inputs are zero-checked here.      A lite deployment ships without the voting system and without the cross-chain layer, so `_leafVoter` and      `_icaRouter` may be zero. A zero voter makes `IS_ROOT` false, leaves the emission token zero, and disables the      gauge staking and claim commands; a zero ICA router disables `EXECUTE_CROSS_CHAIN` and the `BRIDGE_TOKEN`      path that derives a destination interchain account. Those revert with `CommandDisabled` when dispatched,      while a `BRIDGE_TOKEN` naming a direct recipient stays available.\",\"params\":{\"_factoryRegistry\":\"Registry used to authenticate recorded pools and CL factories, require factory approval        for pool creation, and resolve permanent factory relationships backing position managers.\",\"_icaRouter\":\"Interchain account router used by the cross-chain commands. Zero on a lite deployment with no        cross-chain layer, where every command that derives an interchain account is disabled.\",\"_leafVoter\":\"Leaf Voter used to validate gauge targets and, on leaf, to resolve the emission `ReceiptToken`.        Zero on a lite deployment with no voting system, where the gauge staking and claim commands are disabled.\",\"_nativeErc20\":\"ERC20 entry point of the chain's native asset, whose spend resolution and closing sweep are        capped so they cannot drain the pre-batch native balance. Zero on a chain whose native asset has no ERC20        entry point. A nonzero native ERC20 must report its decimals: the native-to-token scale is derived from        them, so a native ERC20 expressing the native asset in fewer decimals than native's eighteen converts correctly.\",\"_relayFactoryRegistry\":\"RelayFactoryRegistry used only on root to authenticate `DEPOSIT_RELAY` relays through        their factory; unused on leaf.\",\"_rootVoter\":\"Root Voter used only on root to resolve the emission token and the staking escrow; unused on leaf.\",\"_weth\":\"Wrapped native token used by payment commands. Zero on a chain with no wrapped-native token, where        `WRAP_ETH` and `UNWRAP_WETH` revert with `CommandDisabled`. Never the native ERC20.\"}},\"execute(bytes,bytes[],uint256)\":{\"params\":{\"_commands\":\"One byte per command, index-aligned with `_inputs`.\",\"_deadline\":\"Timestamp after which the batch reverts.\",\"_inputs\":\"ABI-encoded arguments for each command.\"}},\"msgSender()\":{\"returns\":{\"_sender\":\"Logical sender for the current batch.\"}},\"onERC721Received(address,address,uint256,bytes)\":{\"details\":\"Accepts a position only while a batch is active, and only when the calling collection, the sender, and the      position all match what the active command set through `MetarouterState.setExpectedNft`, then records the      `(collection, tokenId)` pair for the closing ownership check. A CL gauge returns unstaked positions through      `safeTransferFrom`, which is why the router implements the receiver.      This check is the custody boundary. A tracked position is one later commands may operate, so accepting an      unsolicited transfer would let a third party hand the active batch authority over a position it never asked      for. An unset slot reads zero and is rejected outright rather than compared, so a hook call reporting a zero      `_from` cannot slip through while the router expects nothing. Matching the token id too keeps a misbehaving      gauge from returning a different position than the one the command asked back.      The collection is matched rather than compared against a canonical manager: the router holds none, so each      command publishes the manager it resolved. Every argument here except `msg.sender` is chosen by the caller, so      without that comparison any contract could present the expected sender and token id and be recorded as a      custodied collection, and a position from one manager could satisfy state armed for another that issued the      same id.\"},\"uniswapV3SwapCallback(int256,int256,bytes)\":{\"params\":{\"_amount0Delta\":\"Signed token0 amount owed to or sent by the pool.\",\"_amount1Delta\":\"Signed token1 amount owed to or sent by the pool.\",\"_data\":\"Callback payer and input authorization encoded by the active swap command.\"}}},\"stateVariables\":{\"EMISSION_TOKEN\":{\"return\":\"The gauge-emissions token this router custodies and sweeps.\",\"returns\":{\"_0\":\"The gauge-emissions token this router custodies and sweeps.\"}},\"FACTORY_REGISTRY\":{\"return\":\"Factory registry used by venue-sensitive commands.\",\"returns\":{\"_0\":\"Factory registry used by venue-sensitive commands.\"}},\"ICA_ROUTER\":{\"details\":\"The zero address on a lite deployment with no cross-chain layer, where every command that derives an      interchain account reverts with `CommandDisabled`. A `BRIDGE_TOKEN` naming a direct recipient never reads      this router, so it stays available there.\",\"return\":\"The interchain account router.\",\"returns\":{\"_0\":\"The interchain account router.\"}},\"IS_ROOT\":{\"details\":\"Gates the root-only `CREATE_STAKE` and `DEPOSIT_RELAY` commands; derived at construction from whether the      local chain id equals the orchestrator's `ROOT_CHAIN_ID`.\",\"return\":\"True on the root deployment, false on a leaf.\",\"returns\":{\"_0\":\"True on the root deployment, false on a leaf.\"}},\"LEAF_VOTER\":{\"details\":\"The zero address on a lite deployment with no voting system, where the gauge staking and claim commands      revert with `CommandDisabled`.\",\"return\":\"The leaf Voter.\",\"returns\":{\"_0\":\"The leaf Voter.\"}},\"NATIVE_ERC20\":{\"details\":\"The token's balance is the account's native balance expressed in the token's own decimals, so spend      resolution caps it at the batch's own native converted through `NATIVE_ERC20_SCALE`: spending the full      balance would drain the pre-batch native the batch must preserve and revert the closure.      The closing sweep skips its entry point entirely and returns the batch's portion through the native refund,      since some implementations reject a zero-value `transfer`; a recipient that rejects that refund is paid      through this entry point instead. On implementations that reject value-less transfers the ERC20-style      commands on this token revert mid-batch too; that is the token's own behavior, not the router's.      Never transfer or pre-fund this token ahead of `execute`: provide it as `msg.value` or pull it through      `FUND_ERC20` during the active batch. Value the router already holds when a batch opens counts as pre-batch      native, is excluded from batch custody, and cannot be recovered.\",\"return\":\"The native ERC20, or the zero address when the chain has none.\",\"returns\":{\"_0\":\"The native ERC20, or the zero address when the chain has none.\"}},\"NATIVE_ERC20_SCALE\":{\"details\":\"Some chains express the same native asset in different precisions per interface: eighteen decimals for      `address.balance` and `msg.value`, the token's own decimals for `balanceOf` and `transfer`. Every place      that mixes the two representations converts through this factor: the batch's spendable native — less any      committed message fee — converts to the native ERC20 decimals rounding down, so a full spend can never reach the      pre-batch native; a native refund paid through the native ERC20 also floors, leaving dust the token cannot      express. One on an eighteen-decimal native ERC20, where both interfaces share raw values.\",\"return\":\"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20.\",\"returns\":{\"_0\":\"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20.\"}},\"RELAY_FACTORY_REGISTRY\":{\"return\":\"The RelayFactoryRegistry, or the zero address on a leaf.\",\"returns\":{\"_0\":\"The RelayFactoryRegistry, or the zero address on a leaf.\"}},\"STAKING_ESCROW\":{\"return\":\"The VotingEscrow, or the zero address on a leaf.\",\"returns\":{\"_0\":\"The VotingEscrow, or the zero address on a leaf.\"}},\"STAKING_TOKEN\":{\"return\":\"The staking token, or the zero address on a leaf.\",\"returns\":{\"_0\":\"The staking token, or the zero address on a leaf.\"}},\"WETH\":{\"return\":\"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled.\",\"returns\":{\"_0\":\"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled.\"}}},\"title\":\"Metarouter\",\"version\":1},\"userdoc\":{\"errors\":{\"AmountOverflow()\":[{\"notice\":\"Thrown when an amount cannot be represented as a signed CL swap amount.\"}],\"BatchNotActive()\":[{\"notice\":\"Thrown when an inbound asset reaches the router outside a batch.\"}],\"BridgeQuoteExceedsBudget(uint256,uint256)\":[{\"notice\":\"Thrown when a native warp route quotes the reduced bridge amount above the resolved budget.\"}],\"BridgeTokenMismatch()\":[{\"notice\":\"Thrown when the caller-selected warp route does not manage the token being bridged: the route's `token()`         does not equal the command's token, so it would pull or burn a different asset than the router approved.         Guards an honest token/route mismatch; an untrusted route can still misreport, so this is not route trust.\"}],\"CallbackNotCleared(address)\":[{\"notice\":\"Thrown when a CL pool returns without consuming its callback authorization.\"}],\"CommandDisabled(uint256)\":[{\"notice\":\"Thrown when a command depends on a protocol contract this deployment was built without.\"}],\"ContractLocked()\":[{\"notice\":\"Thrown when an external caller enters `execute()` while a batch is running.\"}],\"DirectCallRequired()\":[{\"notice\":\"Thrown when Metarouter is reached through delegatecall instead of a direct call.\"}],\"Expired()\":[{\"notice\":\"Thrown when the batch deadline has passed.\"}],\"FactoryNotApproved()\":[{\"notice\":\"Thrown when an operation requiring current target-factory approval selects an unapproved factory.\"}],\"GaugeFactoryMismatch(address,address,address)\":[{\"notice\":\"Thrown when a gauge reports a factory other than the one permanently recorded for it.\"}],\"GaugeNotRegistered()\":[{\"notice\":\"Thrown when a claim or stake targets a gauge not registered with the Voter.\"}],\"InFlightNftPresent()\":[{\"notice\":\"Thrown when a producer command would leave a second NFT in flight before the first is consumed.\"}],\"InsufficientAmount0()\":[{\"notice\":\"Thrown when a liquidity command's resolved token0 amount falls below its minimum.\"}],\"InsufficientAmount1()\":[{\"notice\":\"Thrown when a liquidity command's resolved token1 amount falls below its minimum.\"}],\"InsufficientAmountA()\":[{\"notice\":\"Thrown when an add-liquidity command's resolved tokenA amount falls below its minimum.\"}],\"InsufficientAmountB()\":[{\"notice\":\"Thrown when an add-liquidity command's resolved tokenB amount falls below its minimum.\"}],\"InsufficientBalance(address)\":[{\"notice\":\"Thrown when the execution-address balance cannot cover a spend or minimum floor.\"}],\"InsufficientLiquidityMinted(uint256,uint256)\":[{\"notice\":\"Thrown when an add-liquidity command mints fewer LP tokens than requested.\"}],\"InvalidAmountOut()\":[{\"notice\":\"Thrown when an exact-output swap delivers a different output than the requested amount.\"}],\"InvalidBridgeQuote()\":[{\"notice\":\"Thrown when a caller-selected warp route quotes a total charge below the amount being bridged, which no         honest route reports because the charge covers the delivered amount itself.\"}],\"InvalidCallbackCaller(address)\":[{\"notice\":\"Thrown when a caller is not the currently authorized CL pool.\"}],\"InvalidCallbackDeltas()\":[{\"notice\":\"Thrown when a callback does not contain exactly one positive token delta.\"}],\"InvalidCommandType(uint256)\":[{\"notice\":\"Thrown when a command byte decodes to an undefined command ID.\"}],\"InvalidEthSender()\":[{\"notice\":\"Thrown when ETH arrives from an unexpected sender outside a batch.\"}],\"InvalidGaugeType()\":[{\"notice\":\"Thrown when position ids are supplied for a gauge that does not support position-level claims.\"}],\"InvalidHookMetadata()\":[{\"notice\":\"Thrown when a cross-chain dispatch's hook metadata carries no refund address.\"}],\"InvalidInterchainAccountConfig()\":[{\"notice\":\"Thrown when an interchain account configuration names an ISM without a custom destination router.\"}],\"InvalidNativeErc20Decimals()\":[{\"notice\":\"Thrown when the native ERC20 reports more decimals than the native asset's eighteen.\"}],\"InvalidNftSender()\":[{\"notice\":\"Thrown when an NFT arrives from a collection other than the one the active command solicited.\"}],\"InvalidPath()\":[{\"notice\":\"Thrown when a pool path is empty or its adjacent tokens do not connect.\"}],\"InvalidPayer()\":[{\"notice\":\"Thrown when a payer is neither the execution address nor the logical sender.\"}],\"InvalidPips(uint256)\":[{\"notice\":\"Thrown when a pip spend exceeds 100%.\"}],\"InvalidPool(address)\":[{\"notice\":\"Thrown when a pool has no recorded factory, its recorded factory does not authenticate it or differs         from the supplied factory, or its pool family is unsupported for the command.\"}],\"InvalidRecipient()\":[{\"notice\":\"Thrown when a payment command names an invalid recipient.\"}],\"InvalidReserves(address)\":[{\"notice\":\"Thrown when a V2 pool's token balance is below its recorded input reserve.\"}],\"InvalidSpendMode()\":[{\"notice\":\"Thrown when an external pull uses a router-balance spend mode.\"}],\"InvalidSwapDeltas()\":[{\"notice\":\"Thrown when a CL swap reports a positive output-token delta.\"}],\"LengthMismatch()\":[{\"notice\":\"Thrown when the commands and inputs arrays differ in length.\"}],\"NativeBalanceNotCleared()\":[{\"notice\":\"Thrown when the router's native balance differs from its pre-batch balance after the closing refund.\"}],\"NativeTransferFailed(bytes)\":[{\"notice\":\"Thrown when a native ETH transfer fails, bubbling the callee's revert data.\"}],\"NftNotCleared()\":[{\"notice\":\"Thrown when a tracked NFT still belongs to the router at batch closure.\"}],\"NftNotInCustody()\":[{\"notice\":\"Thrown when a command would operate a router-held NFT that did not enter custody during the active batch.\"}],\"NftNotReceived()\":[{\"notice\":\"Thrown when a gauge withdrawal returns without delivering the requested position through the receiver.\"}],\"NftSenderNotCleared()\":[{\"notice\":\"Thrown when a command would arm an expected NFT sender while another authorization is still pending.\"}],\"NoInFlightNft()\":[{\"notice\":\"Thrown when a command references the in-flight NFT but none of the expected collection is in flight.\"}],\"NotLeaf(uint256)\":[{\"notice\":\"Thrown when a leaf-only command (redeem) runs on the root deployment.\"}],\"NotPositionOwner()\":[{\"notice\":\"Thrown when a CL position command targets a position the logical sender does not own.\"}],\"NotRoot(uint256)\":[{\"notice\":\"Thrown when a root-only command (sAERO creation or relay deposit) runs on a leaf deployment.\"}],\"PenaltyNotAccepted()\":[{\"notice\":\"Thrown when a routed V2 gauge claim or withdrawal would incur a penalty without explicit user consent.\"}],\"PoolNotFound()\":[{\"notice\":\"Thrown when the pair has no pool and the command may not create one.\"}],\"PoolNotRegistered()\":[{\"notice\":\"Thrown when a V2 liquidity command or fee claim targets a pool without a FactoryRegistry creation record.\"}],\"PoolTokenMismatch(address)\":[{\"notice\":\"Thrown when the factory resolves a pool that does not hold the requested token pair.\"}],\"PositionManagerFactoryMismatch(address,address)\":[{\"notice\":\"Thrown when the position manager a factory names does not point back at that factory.\"}],\"PositionManagerNotConfigured(address)\":[{\"notice\":\"Thrown when no record names a factory's position manager: the factory getter returns the zero address,         or it reverts and the registry pairs the factory with no gauge factory, or the paired gauge factory         binds the zero address.\"}],\"PreBatchNativeBalanceSpent()\":[{\"notice\":\"Thrown when a batch spends native ETH held before that batch started.\"}],\"SameDomainCrossCollateralTransfer()\":[{\"notice\":\"Thrown when explicit cross-collateral routing targets the origin domain's synchronous transfer path.\"}],\"TokenFeeExceedsAmount()\":[{\"notice\":\"Thrown when a warp route's token fee equals or exceeds the amount being bridged, leaving nothing to         deliver.\"}],\"TokenFeeExceedsMax()\":[{\"notice\":\"Thrown when a warp route's token fee exceeds the caller's accepted maximum.\"}],\"TooLittleReceived(uint256,uint256)\":[{\"notice\":\"Thrown when an exact-input swap receives less than its minimum.\"}],\"TooMuchRequested()\":[{\"notice\":\"Thrown when a swap requires more input than the command authorized.\"}],\"UnauthorizedRelay()\":[{\"notice\":\"Thrown when a relay deposit targets an address whose reported factory the RelayFactoryRegistry does not         approve, or which that factory did not create.\"}],\"UnauthorizedRelayVpm()\":[{\"notice\":\"Thrown when a relay reports a VoterPaymentsModule the staking escrow does not recognize (it lacks         `VPM_ROLE`), so the router refuses to grant it the operator approval a deposit needs.\"}],\"UnexpectedNftSender()\":[{\"notice\":\"Thrown when a position arrives from a sender the active command did not solicit it from.\"}],\"UnregisteredDomain()\":[{\"notice\":\"Thrown when a cross-chain dispatch targets a domain with no interchain account router enrolled.\"}],\"UnsupportedBridgeFeeToken(address)\":[{\"notice\":\"Thrown when a bridge quote includes a nonzero fee in a token other than the source token or native         currency.\"}],\"UnsupportedCrossCollateralToken()\":[{\"notice\":\"Thrown when explicit cross-collateral routing is requested with the zero-address native-token marker.\"}],\"WethIsNativeErc20()\":[{\"notice\":\"Thrown when the wrapped native token and the native ERC20 are the same address.\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown when a constructor dependency is the zero address.\"}],\"ZeroAmount()\":[{\"notice\":\"Thrown when a command resolves a zero asset amount to act on.\"}]},\"events\":{\"BatchExecuted(address)\":{\"notice\":\"Emitted when the outermost frame of a batch completes.\"}},\"kind\":\"user\",\"methods\":{\"EMISSION_TOKEN()\":{\"notice\":\"Token delivered to recipients by a gauge-emissions claim on this chain: the `ReceiptToken` on leaf         deployments, or the canonical `TOKEN` on root, where the receipt is redeemed for `TOKEN` in the same         transaction.\"},\"FACTORY_REGISTRY()\":{\"notice\":\"Registry used to authenticate pools, target factories, and gauge-to-factory relationships.\"},\"ICA_ROUTER()\":{\"notice\":\"Interchain account router used by the cross-chain commands to derive accounts and dispatch commitments.\"},\"IS_ROOT()\":{\"notice\":\"Whether this deployment is the root chain, where `VotingEscrow` and the Relay exist.\"},\"LEAF_VOTER()\":{\"notice\":\"Leaf Voter used to validate gauge targets and resolve their reward contracts.\"},\"NATIVE_ERC20()\":{\"notice\":\"ERC20 entry point of the chain's native asset, on chains where one exists; the zero address elsewhere.\"},\"NATIVE_ERC20_SCALE()\":{\"notice\":\"Native value represented by one raw unit of the native ERC20, derived from the token's decimals.\"},\"RELAY_FACTORY_REGISTRY()\":{\"notice\":\"RelayFactoryRegistry that `DEPOSIT_RELAY` authenticates a caller-selected relay's factory against; the         zero address on a leaf deployment, where the command is gated off.\"},\"STAKING_ESCROW()\":{\"notice\":\"VotingEscrow that `CREATE_STAKE` and `DEPOSIT_RELAY` act on, resolved from the root Voter's         `VOTING_ESCROW()`; the zero address on a leaf deployment.\"},\"STAKING_TOKEN()\":{\"notice\":\"Token `CREATE_STAKE` stakes into a new sAERO, resolved from `STAKING_ESCROW.TOKEN()`; zero on a leaf.\"},\"WETH()\":{\"notice\":\"Wrapped native token used by wrap and unwrap commands.\"},\"constructor\":{\"notice\":\"Initializes the Metarouter.\"},\"execute(bytes,bytes[],uint256)\":{\"notice\":\"Runs an ordered command batch as one atomic call.\"},\"msgSender()\":{\"notice\":\"Returns the account whose positions and approvals commands act for.\"},\"uniswapV3SwapCallback(int256,int256,bytes)\":{\"notice\":\"Pays the input token owed to the currently authenticated CL pool.\"}},\"notice\":\"Permissionless router for executing composable command batches with temporary asset custody,         returning remaining batch ERC20 and native balances to the original caller when execution ends. Positions         are not returned: one brought into custody must be sent onward by a later command, or closure reverts.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"V3/src/metarouter/Metarouter.sol\":\"Metarouter\"},\"evmVersion\":\"prague\",\"libraries\":{\"V3/src/metarouter/Metarouter.sol:ClPositionLib\":\"0x96fa373a6d7930d67accf441529ccf3477405493\",\"V3/src/metarouter/Metarouter.sol:ClaimsLib\":\"0x8eda4655fd8e6bb3aff3d3f36610b1efec24aa22\",\"V3/src/metarouter/Metarouter.sol:CrosschainLib\":\"0x47a3b182d028d503a6e6cd2bd1b4c11960d12113\",\"V3/src/metarouter/Metarouter.sol:LiquidityLib\":\"0x0028a78d20d2d5d230cc4b2a23b90793a95cb691\",\"V3/src/metarouter/Metarouter.sol:PaymentsLib\":\"0xa37042e33c31e41b74bf18f0c1b27000f10e9e13\",\"V3/src/metarouter/Metarouter.sol:StakeRelayLib\":\"0xff89b14b2f26f2afb27fa65c9ff97f6cbbedda6e\",\"V3/src/metarouter/Metarouter.sol:StakingLib\":\"0xe463e88df582c0b7a6d530f85c2c6954fb4f3c00\"},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[\":@hyperlane/contracts/=node_modules/@hyperlane-xyz/core/contracts/\",\":@nomad-xyz/src/=node_modules/@nomad-xyz/excessively-safe-call/src/\",\":@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/\",\":@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/\",\":@openzeppelin4/contracts/=node_modules/@openzeppelin/contracts-v4/\",\":@solady/=node_modules/solady/src/\",\":V3-script/=V3/script/\",\":V3-test/=V3/test/\",\":V3/=V3/src/\",\":forge-std/=node_modules/forge-std/src/\",\"node_modules/@hyperlane-xyz/:@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable-v4/\",\"node_modules/@hyperlane-xyz/:@openzeppelin/contracts/=node_modules/@openzeppelin/contracts-v4/\"]},\"sources\":{\"V3/src/interfaces/access/IGuardedAccessControlEnumerable.sol\":{\"keccak256\":\"0x14ecc1e460091086f667201c43778f638863f618369f358f77bc214dfeeac249\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a8c960bc07240dd61bb82640771c9ef6c5c281886a271d600060d0ccde7333a7\",\"dweb:/ipfs/Qmeb5QKdWoWP6WHAihFQvjvEZ4PygUgwEXu8Wou2NhNWn7\"]},\"V3/src/interfaces/bridge/ILeafMessageOrchestrator.sol\":{\"keccak256\":\"0xb8e9f856b05bc5b4d09bce76e123544e2e53f670c86c1ca55fad299c6240caf3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cf1af819cbdd66f47d8d8ae3317631f57e770c1b274aa696de05ca80f4461b58\",\"dweb:/ipfs/QmacgjxRnXrJqcHkAKMjSDzaU8iYaEgxiR6HpDfK64sBQC\"]},\"V3/src/interfaces/bridge/IMessageAdapter.sol\":{\"keccak256\":\"0x7b18fe25644d4afdc7cd1e9c1f6b626c35bcdd885093a3e77876fd76534004bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://12ac646d2458ef421293ea281b890e0b5a8d7939c9be1a24b763bd71b1cd77a2\",\"dweb:/ipfs/QmVX1hX6Hgsg56asv2Xfafw5wQrie8NGR6ytu4JgkCBrPp\"]},\"V3/src/interfaces/bridge/IMessageOrchestrator.sol\":{\"keccak256\":\"0xee174345ab2b659eaec9b9b58a63289b248a5d08dabc7e45945117163d6593b8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://40948f9ebd91c5babeab2d5858dbd567c0dab7e7fecd02b5df755744914fe81f\",\"dweb:/ipfs/QmbK8qec3VGL9KARzUCvrXpNKJn1cuUGotgEpZDfaSFfYB\"]},\"V3/src/interfaces/bridge/IRootMessageOrchestrator.sol\":{\"keccak256\":\"0xbda5bc33f7f230e69adf34f25202dcb1b482c7c249709d6b126b2306a718150d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://48095b4fe71d91d1fb17c95007718377b8d805be76c5f3ad17aeb1e0ae06b7b7\",\"dweb:/ipfs/QmbcDbNvD4r9dJyRdWm3G9YnxkBnpgNMhKprkSbV8gLvRG\"]},\"V3/src/interfaces/core/IVotes.sol\":{\"keccak256\":\"0x8bf8cfa56e792f61a897186caf85406c436d89e6820f91efdc7422bf682490bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5b8754dc21b9072f2fabc1be004c0432cd53b041e7ef94314991485e148a9ec5\",\"dweb:/ipfs/QmRHxAjrzHbYzsPRQvaKgVAhxGuMrKcwUbezu8Yb8W4JxC\"]},\"V3/src/interfaces/core/IVotingEscrow.sol\":{\"keccak256\":\"0x3c4b0789b2aed973e2f5f1a35c29a4d2f846fa3ae59ddd1c4d70f0fc620f2351\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9c3f11f1020cc7b3350e71224f5c1dab0c49d99f83edbd20645184063cef15fc\",\"dweb:/ipfs/QmR65SEqcNif9Aci9tc7mRswARw8ZSyUpzxAUnTjNsocse\"]},\"V3/src/interfaces/external/ICrossCollateralTokenRouter.sol\":{\"keccak256\":\"0x584940cb41958090219fbf6935cfea079169ad924e8e4c6787119b730c8eb205\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7f38915d327f8b058472d9ab030fe9efb32e679b2f1daa17fdc81f1a6ae757f3\",\"dweb:/ipfs/QmeXyGjebF6B9BjiBduJBJPrLmcYKczWXdbWrX4Gdg9TYY\"]},\"V3/src/interfaces/external/IInterchainAccountRouter.sol\":{\"keccak256\":\"0x706eb05a43366e551119fd50a9a10613def52d86897e9764f21dfaf0f6a4a587\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://e1466964436558879f05085916f7575a181f3931ffa4d7fccdabb58218d8b78d\",\"dweb:/ipfs/QmYkST5H9Dg5a16eAvDGcKevvPKfbptEY6WuoAhSqdU7jR\"]},\"V3/src/interfaces/external/INonfungiblePositionManager.sol\":{\"keccak256\":\"0x112c1a16a5604f7de6968b66381a8e6c419f59bb695871000d6bd91d6d86ed87\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e729f0b0a55affe9da10afdc48414f5ee7e7c7ff5e173f0bf944c485662ed370\",\"dweb:/ipfs/QmY8qWD83Q72YgGKhVkWubbpiGKU3LzVxbWGuc3J98JLAE\"]},\"V3/src/interfaces/external/ITokenRouter.sol\":{\"keccak256\":\"0x13afa0065103f06d907581d3a5e660563d5499ef8265e99247084df5b0152759\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d3e58adb2e9255069d9c41199407805a9d926494e169d1c6fd24ec9cdab3631d\",\"dweb:/ipfs/QmXn6HDtCQzvzNK8hk7CeMY3tkZ837qZSr7TdwRFxsgKxx\"]},\"V3/src/interfaces/external/IWETH.sol\":{\"keccak256\":\"0xa391fc9613b32e816c8f767cc82ab694984f1bf0ea9f61dcf5cdf87395945845\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7c81a4546c01d55e2dd18f38d7fc6e44f668e1dd7f3e9375edcab9f962819789\",\"dweb:/ipfs/QmQuEvdnrCa6cEXnBeVbeycN34FASosGfvKNoYDbFwBjv2\"]},\"V3/src/interfaces/factories/ICLFactory.sol\":{\"keccak256\":\"0xef86a35f2495a2af31df4eac61628ca880419ff3d4ca269ae49e2ee36bc3c3a8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ddcb537776ac23ecdf4f34fc56d693100e61743124a2617c9901d8f5f10c15c0\",\"dweb:/ipfs/QmZtWHAnbanbEVGVr5ZrTRyhQGbGoWaGsZFM63CMBKoEep\"]},\"V3/src/interfaces/factories/ICLGaugeFactory.sol\":{\"keccak256\":\"0xc44daf33651bd4f6f3ff5b403fbcd11961b34aaf31aa6ad3dde196d33957fa4a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://920ba5d94cffc6e6b5ce9fc70852e75bfec6f3a6514cddeee2bd2992c315f6fa\",\"dweb:/ipfs/QmSAraAFBeWnTTJbBdJZ46nWovHmRLASTWV1S3vQk5DmMN\"]},\"V3/src/interfaces/factories/IFactoryRegistry.sol\":{\"keccak256\":\"0xd0c221a5de0a966418f408c333a17d63101d192e02df5d45cac26e0fb7b216ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e66a8c6761229ffcb572b73758e5facb06ea88f3d2d45c6096d32977ce8fce25\",\"dweb:/ipfs/QmWfhTxnbU3t3xoDh1ZoPM1mj73x8aDZK7v6wNzSSQBhoA\"]},\"V3/src/interfaces/factories/IGaugeFactory.sol\":{\"keccak256\":\"0x91f64efc63b035fc6223573555877c96a060c6646288340e9bdae0b03b464fb5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://eedbe72aa265105c92b22841794e3279afb46ec62f40f56a3746809da82844ad\",\"dweb:/ipfs/QmQX3AbFRmVwchNofKMZPMnZwRyeDC9sS6MnBnrT22oPjj\"]},\"V3/src/interfaces/factories/IPoolFactory.sol\":{\"keccak256\":\"0x1f8dc8eab9ed8c2af9fdc70a79ad87fa32c0b944ad264dbfa0ff73840b1eb5cd\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://210e03abf15c2b019338710a28df9b19da6f34a50e3274a7a3f21d0004d803d5\",\"dweb:/ipfs/QmYcX93yesan7C2BneWPCdqLJV5nqroCrmPRosCgAsmPSZ\"]},\"V3/src/interfaces/gauges/ICLGauge.sol\":{\"keccak256\":\"0xea26076fff11e0af1fbfd6dc48c3be464b96ba5643dabb310d904720a61cadd2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dec10a45101bd2cd0605bd54d1600465244092dcb47ff071419477ca3c5e3b52\",\"dweb:/ipfs/QmX86b9cy1RuvG7ryDfvNfen1CtFgTEemRDJpxk3ndDw93\"]},\"V3/src/interfaces/gauges/IGauge.sol\":{\"keccak256\":\"0x53d8baab3c9b895e7b4033306227dd1a2b676b5cb64fdc07ba15706f8af3902a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://34db526d9dc2609595338b3bbc492eb62ad71afcbf02030047e4822603e83abc\",\"dweb:/ipfs/QmX3UNyjjd92a69J7TBUDPTMJbT4AGhTvLA7Yb4QrwhbiH\"]},\"V3/src/interfaces/gauges/IV2Gauge.sol\":{\"keccak256\":\"0xfb6b6b5ffd799fe676cadf2c22b7bce5ee69370f5b86fad4171177fb89dad1bc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://eb11ad856e1b45871626ae07ba250488e075fb1d839570036a54c7c12a2bb630\",\"dweb:/ipfs/QmdCt3mJazEm2RRhML2VQNeiRmzN29CYFYQi28gHNYE5nU\"]},\"V3/src/interfaces/governor/IGovernor.sol\":{\"keccak256\":\"0x36e1ca178532510df3fe47b11b9d59bcfdf7a605e514feb46afc4aacb1847e0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://cfa593ed74ec9cbc127bc3fbd8dd5961a43048750d4f2359fb96078b97054d1e\",\"dweb:/ipfs/QmZCu2HfqRgjhYoQzww3MQCcXoZ4XdB4dDg5XJpLKGzPwD\"]},\"V3/src/interfaces/metarouter/IMetarouter.sol\":{\"keccak256\":\"0x72504377ca4b8c8d61abe9213388e5f68f1033723360aa4694b0c55cb93f0c18\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2385baa0fe257b37cb9857e338d4f369efe453fdd18ac545c1df9d472978014f\",\"dweb:/ipfs/QmPXXdiXegAmgWmtbbuTzFHJ9RntQqTjkcHBX2NR6GPeUL\"]},\"V3/src/interfaces/minter/IMinter.sol\":{\"keccak256\":\"0x913f2666af380066174d26816f720a661f244fef6d251418634c2cbf61559daa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8a5e413002cf908df15f334e4cd354a3995bf579682ee1df39d86d28707fe8ea\",\"dweb:/ipfs/QmVy9SysvtfnYaZK3vwHjCyKhvKBJtLop7MfFBtrbTnrho\"]},\"V3/src/interfaces/pools/ICLPool.sol\":{\"keccak256\":\"0xf2475f01b92b8f774e617c876aa90afd199c5735177bae2731b3cde2fb4d42d9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://afe042761795abe8aeaa60ba8db7b5bcdaf7331f2c77904af1200fac4e309669\",\"dweb:/ipfs/QmVrvjPPfNCBVtn6xADPoFMoxxXY4qNvw27dfBgneruTfm\"]},\"V3/src/interfaces/pools/IPool.sol\":{\"keccak256\":\"0x4ac3d8b3381f9f0b24516a34f28a25c36a3f11448b72e11155a8fb47e33cf65c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5e5fd853c52b861cb4884edfdef7519cdac15a852a59f0047ec8582280fb8a68\",\"dweb:/ipfs/QmbxZcm4BH4Nu4V2rm767AtxHnroZofENMSNQJjg4dknc7\"]},\"V3/src/interfaces/pools/tape/IPoolTape.sol\":{\"keccak256\":\"0xbafec7377a6f67eafa045e7395c59cdbab75e2a517207868cb216c69289d1b36\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9bbb4ad7a82504240c578972aa0cb4c5dbcf64a3cd34d455df2878c37061f0a4\",\"dweb:/ipfs/QmPnZJ1JQXdWBo7mStv4Rcw1C51mmBHZp8eSosFyKfa2WU\"]},\"V3/src/interfaces/relay/IRelay.sol\":{\"keccak256\":\"0x126025e3d275c533bd5cfc1f40f2fa8c3878eae0613ab406d46a166f4e397e7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9bf7c3035c3dbdf12e19ae8e30125bd84a5b064c86652186b7603ca0f24402b4\",\"dweb:/ipfs/QmedrJXWn372U4cmQsdey6SJuqgFWYaAQKt7CoUo8VC47p\"]},\"V3/src/interfaces/relay/IRelayFactory.sol\":{\"keccak256\":\"0x76c9eb0e37cd2c50e6d97b6e992404405b6367d48b1c320faf1ff2724559ae99\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d1867dae28c7ff0ae0887663d98d88a72662bd300ae3f4bd0da5fe6d08f8a9d1\",\"dweb:/ipfs/QmcNMrey5LFZ1TJf6rm1mdSTtXq77UqtVcU5oUviwntU46\"]},\"V3/src/interfaces/relay/IRelayFactoryRegistry.sol\":{\"keccak256\":\"0xbac5a96f853734ebc44fc97b3fa8c0fb8daff7830abff0526236be93f1eed135\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://437102bad49823b00b06518348fa85e305a7243d016f9d9009210485775e9a18\",\"dweb:/ipfs/QmXTPCXFZjFqzhAvAvdMRC2DGmyKALTCZE9Bp9bCjS7Gcb\"]},\"V3/src/interfaces/relay/IRelayState.sol\":{\"keccak256\":\"0x60768a03fa28a0eb43c20432332fe83f69f08592d9c18878118d2ee9fa21e08d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6b6488e2abe031d427cf419436b7ca00f5feaa46f0b4e0ce28b7215731d15a49\",\"dweb:/ipfs/QmY4PMmetrAayPSbco1qpfMXpq5NsMCwph94RCedwY8h2j\"]},\"V3/src/interfaces/relay/IRelayToken.sol\":{\"keccak256\":\"0x941cb0863a92aa4bca38f455e7b10f1411638e16f6b692afa09c374f3569b0f1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://97f993927244ea0433b74eebcded0f417893048c1a93a7552dc2499b3a22d5d6\",\"dweb:/ipfs/QmUHoHfftdL7aFfWdjYoAmxj6BqQt3iSrHvEXNv6c4Qo3n\"]},\"V3/src/interfaces/relay/IRelayVoteAdapter.sol\":{\"keccak256\":\"0xad39e2987b04b1ac3ddcfcbd05d01803080c3b39689e4fd8dffc1b773b4c292a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5902474e4141bfd925be3b0acfbe7468c8f2ebe2ab6e84f825388fbe253f3577\",\"dweb:/ipfs/QmRNFshP3GUCmb2w5q33ihnxSqHdwaktDhPsLPk1XzFVjP\"]},\"V3/src/interfaces/token/IBaseTokenExtensions.sol\":{\"keccak256\":\"0x1193e87fd0e41a37a76438271901fd43b6c56cbf0e9a4999ee0fa123d514dae3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://58103c2acbcbbce7d031d1b492daf3b9db25d72933767011bdb128ce40973f25\",\"dweb:/ipfs/QmdHneSTfyJX6PRi6Lia8qdzyLN8G7W5R8C2eKTURpsabs\"]},\"V3/src/interfaces/token/IReceiptTokenExtensions.sol\":{\"keccak256\":\"0xb2275cc40f1ccd0ebecb504d1efe0162341cfae4db8d938bc81441a63a7b917a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://6c57dbcd8a9445ea273c6b16d25da50ad53ad80011a0247e7a1549d885962bb9\",\"dweb:/ipfs/QmRkuv9fnRNpHT5rJqzkfA1j6g5KU2VXfb2jVrWb4pgkKn\"]},\"V3/src/interfaces/token/IToken.sol\":{\"keccak256\":\"0x75669171b54302272b0168c3a10e11e58f62771dba71bcd6835bfa512da125b5\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://9813286031581eabebd81fce3bf8443bc0e4b3a55f6af2bc6a77b78afab37252\",\"dweb:/ipfs/QmeWJBxAMQLWGH1iX17ybAqFjqM9RQx7CVt4X1hBSfPBj5\"]},\"V3/src/interfaces/token/ITokenExtensions.sol\":{\"keccak256\":\"0x49e7226f0a214bb6e9b295fc6220aa154f711ca52d5e1d388278bd91c5d301f4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c13b7c5865e186b6208cf666bb9a439f5d77dd17a472d34b483b3f9cddf30686\",\"dweb:/ipfs/Qmc7EBEEhPxNpXLHEnqt9u43V6CMTXkQaY8RLQKYNe7h86\"]},\"V3/src/interfaces/voter/ILeafVoter.sol\":{\"keccak256\":\"0xe9322fa1c635cc98d8c5d2ea5b2bd870f791d740cdf9f389e1aebe1fe62f2795\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://35da24d74cf2bb922f9f2a0adfe8b4aba7bc5e0fa4922cfb9b9e1ca0dd3899cc\",\"dweb:/ipfs/QmbffNRzXr2qhMZHddeoRTVV1Hms5r31vvQjqMdsgAs9iJ\"]},\"V3/src/interfaces/voter/IVoter.sol\":{\"keccak256\":\"0xea47f4fa7b941883cc8de93f5c80a3d26535565f9edee4e96ea6d4d330a4ca0e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://37b3ac60118f9403de3acc1af8fca7b687298df153a41e6a40c23deddb1382b5\",\"dweb:/ipfs/QmZAy48GcJbpNSBbLTo4XbzZC1hfwTHWb2aXscHT9UTaja\"]},\"V3/src/interfaces/voter/IVoterCommon.sol\":{\"keccak256\":\"0x4d94a455b9073150710fbf6192fe407ceb1f50ab0bd2e325092adeb74684b060\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2ad4d1a2149d0a64ffad7f71da0495f32c2a76ccd3486215d412d6cca61ad0d7\",\"dweb:/ipfs/Qmd11qzHeSC4tFM16UpWrb85y9Ap4BHTfmgPNMzTtoqeuF\"]},\"V3/src/interfaces/vpm/IVoterPaymentsModule.sol\":{\"keccak256\":\"0xe2f96d023fe49ca702b0faa75cf06910953de06557b4db36689722b95395189f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://49ec5cfc18b0dadefb822ff4866e90d8a54e4bbd3b416b1df9f88a9f7e5088e3\",\"dweb:/ipfs/QmTy9UGkPqqzCD2T7UJgHMHgYa9PbDqodGZsmjt6GwgeL4\"]},\"V3/src/libraries/ProtocolConstants.sol\":{\"keccak256\":\"0xa35de7c22660ced91973c97d762d3ad1554f2f2344695a5676a67c8d5cb9f0d0\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://251ee6fc146b6dc763d98525146023e6f579d38349f28cf5d28f4274d91b7423\",\"dweb:/ipfs/QmdtGxudVWw9oKQGcW1tdXhtPcEs4RDKsRp2eoqH3wcxYf\"]},\"V3/src/metarouter/Metarouter.sol\":{\"keccak256\":\"0x493af0f9a9c21ce9fb7e4c91fb938323c4ba6fd4a427d656d24b5e707aceae42\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://9f026a8ab7836456fa8b1ae73d99f7dd28e370714944f556b05267ab6f63548a\",\"dweb:/ipfs/QmfGyvj4UBGYafxUAEpytzPQxAyrFfB92paTHyK5gbKfZh\"]},\"V3/src/metarouter/TransientTracking.sol\":{\"keccak256\":\"0x4e796609c7f041ab518c0f6541858b4b486a8e709674ea4b403121f980f3c510\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://e5dab1841353095ad2f7b3ccd200ba236718cda79d8fe7e7e90de6a25467b3a7\",\"dweb:/ipfs/QmXEi6XdenhxPsgf8Jb5yACPEbxZM8sQUkKiufeu472XoY\"]},\"V3/src/metarouter/libraries/ClPositionLib.sol\":{\"keccak256\":\"0xb35588df2eb9056ad4268e76bbd17234635d241b505c87377af1386c228514c0\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://d05735834dcd47accb67ec2f48292c154cab54342521896ca6d2b08f8a7389ae\",\"dweb:/ipfs/QmYHGE44bjtAVCKxiZL7sypuRERMsEWPU4caUpcVRhTBu6\"]},\"V3/src/metarouter/libraries/ClResolverLib.sol\":{\"keccak256\":\"0x766016b125e3f1cb4401ca293c1186656cce38e85904f24dffc43a1f8a127f56\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://0e9f33d5a30b3f19b67bd65c0af277437b9f0d532cd96507c5606f76624b96b7\",\"dweb:/ipfs/QmZpwbskkve4krGcAqcckfphEV2Maje7qQfmDYz9gvYiYt\"]},\"V3/src/metarouter/libraries/ClaimsLib.sol\":{\"keccak256\":\"0xcb9098efd94cc6d1a2153588bc634ea7a7e018f90fb376bd9344e7247765802d\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://54bc9881cd5a7264babb3899377c3f9c5a4a7c03653247cd34c1acaead8568d4\",\"dweb:/ipfs/QmQbGTqWHkmnqmjMHdM6bBJzL8hu6A3nbEfbHbe3Jg4Lrg\"]},\"V3/src/metarouter/libraries/Commands.sol\":{\"keccak256\":\"0xadd0e4f6e51dc287566403f2ac7040979188c9b34a14c63b7cbf0df43e62dcd9\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://ea804e72c5a1dcdaa384174e5633168e8d3831da25c57be466fb39e483f7106d\",\"dweb:/ipfs/QmQXLSAyqT99DNrMGFVEFBvqmVD1kfXvYSCCdSs2bFQyZ8\"]},\"V3/src/metarouter/libraries/CrosschainLib.sol\":{\"keccak256\":\"0x8d9ad964ab00abdfe3ac3acade779920d8b2bc99062a85517ed83eb46050beba\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://b62dc81e52ba0abbdf168c4db879ab5e9cf7931ae735226029a513e2cfe916cb\",\"dweb:/ipfs/Qmeko1Dgr9t5t5jNhveG2VVuMLgnj92ThQG9jtgRsa465p\"]},\"V3/src/metarouter/libraries/FundsLib.sol\":{\"keccak256\":\"0x6a5aa9fa4e88781ff6c68dd2a239592790b20c3d7efe7ae64a11c6b5902f2070\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://fd8bc01f6a06ea524202c9f4eece3a2667caefed6b211ce4c7a6b081214f27aa\",\"dweb:/ipfs/QmV37DFmFE7h1ox1nqAe5vXAbnNJF7HQ5GJ3QTKAgwZJek\"]},\"V3/src/metarouter/libraries/GaugeLib.sol\":{\"keccak256\":\"0xd15905b084b932b4aa09e8aa4661c9d124d5225914a2f96a574ac23153aabfa9\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://99defc2c16b2374ed917adafe16e5b483889be78a8387a73c6d4655527d74c17\",\"dweb:/ipfs/QmTYyN2mxvsjbUEgAdUnxAhWSUvGaTK1nPKr4yrQodREAV\"]},\"V3/src/metarouter/libraries/LiquidityLib.sol\":{\"keccak256\":\"0x1fcbc834191c1e0ec3727b97d66ce3a8a08f51653e859d2d302b5466c0d74e78\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://7776e1ade2e70844c2f506d40a5a9f585a05ffe660a12d359cbe31866940eae9\",\"dweb:/ipfs/QmR3Q33WXcSppB7nZqoNVLcBiPuGapqjwxXNbMGf2q8Myw\"]},\"V3/src/metarouter/libraries/MetarouterState.sol\":{\"keccak256\":\"0x66999b95ca988e2fbab9062c82ea0c685f5a8bb27098ca1c0f679097f9a2c670\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://d3a6b3e921ec2c50af1548d7297852d9d57b0e9b37c9eae5f989b12fb634527f\",\"dweb:/ipfs/QmamafPgWQQUnEqdVurgSHNjsxnYPsopCvjwTeLqzHKEiX\"]},\"V3/src/metarouter/libraries/PaymentsLib.sol\":{\"keccak256\":\"0x8573b0cf5923cfddf59bdbaeb0bc8580a021c2f3fcefb759beb6cbd9dbb4f179\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://2495ae89b8c658baa9f778f7686bf6425bd8540c5817bee6fe4b4bec75a962c1\",\"dweb:/ipfs/QmZHhwCB8V5RFhxvD5WM2Tav7dYgjhA2AFijuqrPCRPHzU\"]},\"V3/src/metarouter/libraries/StakeRelayLib.sol\":{\"keccak256\":\"0xe3ab9bcc4f32ed8fcfebb09250d33536286f53957c8879de5dcc56e6a7d79b45\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://4e49a6553f7c0cd127de8837dd01d9944e6dde30bad99554b3687663cb7c9004\",\"dweb:/ipfs/Qmba8RgMbVXjhUakxpqkEoxfUeiXfeSR8vVgvmNnzMSyT4\"]},\"V3/src/metarouter/libraries/StakingLib.sol\":{\"keccak256\":\"0x05f1e479a430d03813fccccc5419576123060934c36c54f929497c9101fe821a\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://3cbce08fee8efb77aea5aefc89beaad1dd05cda0be6530919ad4f158aa502894\",\"dweb:/ipfs/QmXneAd8c6XCTcktii9nhT4VTr3Yhzvfvku9GWDCmJupKz\"]},\"V3/src/metarouter/libraries/TokenRouterLib.sol\":{\"keccak256\":\"0xc28c96ec3998401c718c4165f625c79eb4cdb608fb0333a431b1ee0786c88953\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://57ffdf261789654b0c975cdf4a7482bc82fca21d80254ad58e38b1922cf712bf\",\"dweb:/ipfs/QmTcLZkZDsESdeVtvfyPUBKihPRjyZwmoVxajodfiUXG9W\"]},\"V3/src/metarouter/libraries/V2PoolLib.sol\":{\"keccak256\":\"0x3487a47e82f260a7f21a59d05b9d27455d093ca02f61e1669c44dd8cbc582977\",\"license\":\"LicenseRef-Dromos-Restricted-Use-1.0\",\"urls\":[\"bzz-raw://2ee8bcb70b2d5e38566290df62d93267a5f8de0097ab3c8fe9863a1d406d989e\",\"dweb:/ipfs/QmVhM2grBkNuFsxbZiTsQHdP6nEB2jDKGzqDMWRnYKMomv\"]},\"node_modules/@openzeppelin/contracts/access/IAccessControl.sol\":{\"keccak256\":\"0xbff9f59c84e5337689161ce7641c0ef8e872d6a7536fbc1f5133f128887aba3c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b308f882e796f7b79c9502deacb0a62983035c6f6f4e962b319ba6a1f4a77d3d\",\"dweb:/ipfs/QmaWCW7ahEQqFjwhSUhV7Ae7WhfNvzSpE7DQ58hvEooqPL\"]},\"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://da5e832b40fc5c3145d3781e2e5fa60ac2052c9d08af7e300dc8ab80c4343100\",\"dweb:/ipfs/QmTzf7N5ZUdh5raqtzbM11yexiUoLC9z3Ws632MCuycq1d\"]},\"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol\":{\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1c299900ac4ec268d4570ecef0d697a3013cd11a6eb74e295ee3fbc945056037\",\"dweb:/ipfs/Qmab9owJoxcA7vJT5XNayCMaUR1qxqj1NDzzisduwaJMcZ\"]},\"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://1bb2332a7ee26dd0b0de9b7fe266749f54820c99ab6a3bcb6f7e6b751d47ee2d\",\"dweb:/ipfs/QmcRWpaBeCYkhy68PR3B4AgD7asuQk7PwkWxrvJbZcikLF\"]},\"node_modules/@openzeppelin/contracts/interfaces/IERC4906.sol\":{\"keccak256\":\"0x856ca1885aec23d54da3f2760b5d216d1b28ad20f798000336375a30dbbc1558\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dc725c462ccbf284432d3123ab8c9bab24903730cae227ae4945878039d2fe54\",\"dweb:/ipfs/QmdiEVMvm8njp96dm2s4mThYBD74tY59mNP6s7CzKkGHAh\"]},\"node_modules/@openzeppelin/contracts/interfaces/IERC6372.sol\":{\"keccak256\":\"0xed0f7f14eb30c80a82855ddc3f7267bb6290546e5847a8ffc33f599ce4bc5eb6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://63fab00bbb42ce6f132a93d1c1e1cfed5175821521fb8746caa48129787d2435\",\"dweb:/ipfs/QmVMBNhmVW1h35LsaYNyDChfyTwF8M3EW9T1JDFpsXiaQF\"]},\"node_modules/@openzeppelin/contracts/interfaces/IERC721.sol\":{\"keccak256\":\"0xca34c490d41c332106d30b657f00dc028532cb6b9fef2b1729670ce476b36bce\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ef5e7685d50ed8aae2104a7eb2c31ae5a3b508f24fadfa7611f92f819201aee9\",\"dweb:/ipfs/QmYbTD32FPrEfP1hkniQmRxVUWp8GTSqFV1Bhwx1HVirse\"]},\"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://5282825a626cfe924e504274b864a652b0023591fa66f06a067b25b51ba9b303\",\"dweb:/ipfs/QmeCfPykghhMc81VJTrHTC7sF6CRvaA1FXVq2pJhwYp1dV\"]},\"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"keccak256\":\"0xd6fa4088198f04eef10c5bce8a2f4d60554b7ec4b987f684393c01bf79b94d9f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f95ee0bbd4dd3ac730d066ba3e785ded4565e890dbec2fa7d3b9fe3bad9d0d6e\",\"dweb:/ipfs/QmSLr6bHkPFWT7ntj34jmwfyskpwo97T9jZUrk5sz3sdtR\"]},\"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"keccak256\":\"0x53befc41288eaa87edcd3a7be7e8475a32e44c6a29f9bf52fae789781301d9ff\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a1d7fab53c4ceaf42391b83d9b36d7e9cc524a8da125cffdcd32c56560f9d1c9\",\"dweb:/ipfs/QmaRZdVhQdqNXofeimibkBG65q9GVcXVZEGpycwwX3znC6\"]},\"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"keccak256\":\"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://299ced486011781dc98f638059678323c03079fefae1482abaa2135b22fa92d0\",\"dweb:/ipfs/QmbZNbcPTBxNvwChavN2kkZZs7xHhYL7mv51KrxMhsMs3j\"]},\"node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"keccak256\":\"0xf78f05f3b8c9f75570e85300d7b4600d7f6f6a198449273f31d44c1641adb46f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e28b872613b45e0e801d4995aa4380be2531147bfe2d85c1d6275f1de514fba3\",\"dweb:/ipfs/QmeeFcfShHYaS3BdgVj78nxR28ZaVUwbvr66ud8bT6kzw9\"]},\"node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"keccak256\":\"0x88cd5e3bee2e8c36b8d9058fbcaa81ad5704281b25634122234b55ea853d8055\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8dc7e7ab5b8ea36c15027ab04221b05d1c970f47a53e9fd47ead8ca665d49c7e\",\"dweb:/ipfs/Qmeeph7fsDyfRr8vb2L8KcDEmKPb224TAayMvgqgGAnqpL\"]},\"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol\":{\"keccak256\":\"0xaa3852717be1903bf8b8a66c7ce323f70ac93227769c450f2b332fdd16bd9198\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://09ce2e4a5b1064a392594c0d5efeb3ccd8eacf431e55a85574cafb6bfb72ba69\",\"dweb:/ipfs/QmUbT5UomYpwwMrNMzzuNcGb4sxuMZ4jz8mMPZewX8mEPn\"]},\"node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"keccak256\":\"0xf46268c37522320bb2119a5a394bc5c739a95c0c574c8d08e8c643f4d06e5c76\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://517e4b295f35b9947c72ad7379a6089439ece7bb6f4a2ea0a159da13046c039e\",\"dweb:/ipfs/QmZXzkSfLUbvujig3zVbpDHykpHhqLpvQtdiN3B5j4TA3u\"]},\"node_modules/@openzeppelin/contracts/utils/Panic.sol\":{\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c6a5ff4f9fd8649b7ee20800b7fa387d3465bd77cf20c2d1068cd5c98e1ed57a\",\"dweb:/ipfs/QmVSaVJf9FXFhdYEYeCEfjMVHrxDh5qL4CGkxdMWpQCrqG\"]},\"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://971f954442df5c2ef5b5ebf1eb245d7105d9fbacc7386ee5c796df1d45b21617\",\"dweb:/ipfs/QmadRjHbkicwqwwh61raUEapaVEtaLMcYbQZWs9gUkgj3u\"]},\"node_modules/@openzeppelin/contracts/utils/math/Math.sol\":{\"keccak256\":\"0x59973a93b1f983f94e10529f46ca46544a9fec2b5f56fb1390bbe9e0dc79f857\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c55ef8f0b9719790c2ae6f81d80a59ffb89f2f0abe6bc065585bd79edce058c5\",\"dweb:/ipfs/QmNNmCbX9NjPXKqHJN8R1WC2rNeZSQrPZLd6FF6AKLyH5Y\"]},\"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"keccak256\":\"0xc8cae21c9ae4a46e5162ff9bf5b351d6fa6a6eba72d515f3bc1bdfeda7fdf083\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ce830ebcf28e31643caba318996db3763c36d52cd0f23798ba83c135355d45e9\",\"dweb:/ipfs/QmdGPcvptHN7UBCbUYBbRX3hiRVRFLRwno8b4uga6uFNif\"]}},\"version\":1}","userdoc":{"kind":"user","errors":{"Expired()":[{"notice":"Thrown when the batch deadline has passed."}],"ZeroAmount()":[{"notice":"Thrown when a command resolves a zero asset amount to act on."}],"InvalidPath()":[{"notice":"Thrown when a pool path is empty or its adjacent tokens do not connect."}],"ZeroAddress()":[{"notice":"Thrown when a constructor dependency is the zero address."}],"InvalidPayer()":[{"notice":"Thrown when a payer is neither the execution address nor the logical sender."}],"PoolNotFound()":[{"notice":"Thrown when the pair has no pool and the command may not create one."}],"NftNotCleared()":[{"notice":"Thrown when a tracked NFT still belongs to the router at batch closure."}],"NoInFlightNft()":[{"notice":"Thrown when a command references the in-flight NFT but none of the expected collection is in flight."}],"AmountOverflow()":[{"notice":"Thrown when an amount cannot be represented as a signed CL swap amount."}],"BatchNotActive()":[{"notice":"Thrown when an inbound asset reaches the router outside a batch."}],"ContractLocked()":[{"notice":"Thrown when an external caller enters `execute()` while a batch is running."}],"LengthMismatch()":[{"notice":"Thrown when the commands and inputs arrays differ in length."}],"NftNotReceived()":[{"notice":"Thrown when a gauge withdrawal returns without delivering the requested position through the receiver."}],"NotLeaf(uint256)":[{"notice":"Thrown when a leaf-only command (redeem) runs on the root deployment."}],"NotRoot(uint256)":[{"notice":"Thrown when a root-only command (sAERO creation or relay deposit) runs on a leaf deployment."}],"NftNotInCustody()":[{"notice":"Thrown when a command would operate a router-held NFT that did not enter custody during the active batch."}],"InvalidAmountOut()":[{"notice":"Thrown when an exact-output swap delivers a different output than the requested amount."}],"InvalidEthSender()":[{"notice":"Thrown when ETH arrives from an unexpected sender outside a batch."}],"InvalidGaugeType()":[{"notice":"Thrown when position ids are supplied for a gauge that does not support position-level claims."}],"InvalidNftSender()":[{"notice":"Thrown when an NFT arrives from a collection other than the one the active command solicited."}],"InvalidRecipient()":[{"notice":"Thrown when a payment command names an invalid recipient."}],"InvalidSpendMode()":[{"notice":"Thrown when an external pull uses a router-balance spend mode."}],"NotPositionOwner()":[{"notice":"Thrown when a CL position command targets a position the logical sender does not own."}],"TooMuchRequested()":[{"notice":"Thrown when a swap requires more input than the command authorized."}],"InvalidSwapDeltas()":[{"notice":"Thrown when a CL swap reports a positive output-token delta."}],"PoolNotRegistered()":[{"notice":"Thrown when a V2 liquidity command or fee claim targets a pool without a FactoryRegistry creation record."}],"UnauthorizedRelay()":[{"notice":"Thrown when a relay deposit targets an address whose reported factory the RelayFactoryRegistry does not         approve, or which that factory did not create."}],"WethIsNativeErc20()":[{"notice":"Thrown when the wrapped native token and the native ERC20 are the same address."}],"DirectCallRequired()":[{"notice":"Thrown when Metarouter is reached through delegatecall instead of a direct call."}],"FactoryNotApproved()":[{"notice":"Thrown when an operation requiring current target-factory approval selects an unapproved factory."}],"GaugeNotRegistered()":[{"notice":"Thrown when a claim or stake targets a gauge not registered with the Voter."}],"InFlightNftPresent()":[{"notice":"Thrown when a producer command would leave a second NFT in flight before the first is consumed."}],"InvalidBridgeQuote()":[{"notice":"Thrown when a caller-selected warp route quotes a total charge below the amount being bridged, which no         honest route reports because the charge covers the delivered amount itself."}],"InvalidPips(uint256)":[{"notice":"Thrown when a pip spend exceeds 100%."}],"InvalidPool(address)":[{"notice":"Thrown when a pool has no recorded factory, its recorded factory does not authenticate it or differs         from the supplied factory, or its pool family is unsupported for the command."}],"PenaltyNotAccepted()":[{"notice":"Thrown when a routed V2 gauge claim or withdrawal would incur a penalty without explicit user consent."}],"TokenFeeExceedsMax()":[{"notice":"Thrown when a warp route's token fee exceeds the caller's accepted maximum."}],"UnregisteredDomain()":[{"notice":"Thrown when a cross-chain dispatch targets a domain with no interchain account router enrolled."}],"BridgeTokenMismatch()":[{"notice":"Thrown when the caller-selected warp route does not manage the token being bridged: the route's `token()`         does not equal the command's token, so it would pull or burn a different asset than the router approved.         Guards an honest token/route mismatch; an untrusted route can still misreport, so this is not route trust."}],"InsufficientAmount0()":[{"notice":"Thrown when a liquidity command's resolved token0 amount falls below its minimum."}],"InsufficientAmount1()":[{"notice":"Thrown when a liquidity command's resolved token1 amount falls below its minimum."}],"InsufficientAmountA()":[{"notice":"Thrown when an add-liquidity command's resolved tokenA amount falls below its minimum."}],"InsufficientAmountB()":[{"notice":"Thrown when an add-liquidity command's resolved tokenB amount falls below its minimum."}],"InvalidHookMetadata()":[{"notice":"Thrown when a cross-chain dispatch's hook metadata carries no refund address."}],"NftSenderNotCleared()":[{"notice":"Thrown when a command would arm an expected NFT sender while another authorization is still pending."}],"UnexpectedNftSender()":[{"notice":"Thrown when a position arrives from a sender the active command did not solicit it from."}],"UnauthorizedRelayVpm()":[{"notice":"Thrown when a relay reports a VoterPaymentsModule the staking escrow does not recognize (it lacks         `VPM_ROLE`), so the router refuses to grant it the operator approval a deposit needs."}],"InvalidCallbackDeltas()":[{"notice":"Thrown when a callback does not contain exactly one positive token delta."}],"TokenFeeExceedsAmount()":[{"notice":"Thrown when a warp route's token fee equals or exceeds the amount being bridged, leaving nothing to         deliver."}],"CommandDisabled(uint256)":[{"notice":"Thrown when a command depends on a protocol contract this deployment was built without."}],"InvalidReserves(address)":[{"notice":"Thrown when a V2 pool's token balance is below its recorded input reserve."}],"NativeBalanceNotCleared()":[{"notice":"Thrown when the router's native balance differs from its pre-batch balance after the closing refund."}],"PoolTokenMismatch(address)":[{"notice":"Thrown when the factory resolves a pool that does not hold the requested token pair."}],"CallbackNotCleared(address)":[{"notice":"Thrown when a CL pool returns without consuming its callback authorization."}],"InvalidCommandType(uint256)":[{"notice":"Thrown when a command byte decodes to an undefined command ID."}],"NativeTransferFailed(bytes)":[{"notice":"Thrown when a native ETH transfer fails, bubbling the callee's revert data."}],"InsufficientBalance(address)":[{"notice":"Thrown when the execution-address balance cannot cover a spend or minimum floor."}],"InvalidNativeErc20Decimals()":[{"notice":"Thrown when the native ERC20 reports more decimals than the native asset's eighteen."}],"PreBatchNativeBalanceSpent()":[{"notice":"Thrown when a batch spends native ETH held before that batch started."}],"InvalidCallbackCaller(address)":[{"notice":"Thrown when a caller is not the currently authorized CL pool."}],"InvalidInterchainAccountConfig()":[{"notice":"Thrown when an interchain account configuration names an ISM without a custom destination router."}],"UnsupportedCrossCollateralToken()":[{"notice":"Thrown when explicit cross-collateral routing is requested with the zero-address native-token marker."}],"TooLittleReceived(uint256,uint256)":[{"notice":"Thrown when an exact-input swap receives less than its minimum."}],"UnsupportedBridgeFeeToken(address)":[{"notice":"Thrown when a bridge quote includes a nonzero fee in a token other than the source token or native         currency."}],"SameDomainCrossCollateralTransfer()":[{"notice":"Thrown when explicit cross-collateral routing targets the origin domain's synchronous transfer path."}],"PositionManagerNotConfigured(address)":[{"notice":"Thrown when no record names a factory's position manager: the factory getter returns the zero address,         or it reverts and the registry pairs the factory with no gauge factory, or the paired gauge factory         binds the zero address."}],"BridgeQuoteExceedsBudget(uint256,uint256)":[{"notice":"Thrown when a native warp route quotes the reduced bridge amount above the resolved budget."}],"InsufficientLiquidityMinted(uint256,uint256)":[{"notice":"Thrown when an add-liquidity command mints fewer LP tokens than requested."}],"GaugeFactoryMismatch(address,address,address)":[{"notice":"Thrown when a gauge reports a factory other than the one permanently recorded for it."}],"PositionManagerFactoryMismatch(address,address)":[{"notice":"Thrown when the position manager a factory names does not point back at that factory."}]},"events":{"BatchExecuted(address)":{"notice":"Emitted when the outermost frame of a batch completes."}},"notice":"Permissionless router for executing composable command batches with temporary asset custody,         returning remaining batch ERC20 and native balances to the original caller when execution ends. Positions         are not returned: one brought into custody must be sent onward by a later command, or closure reverts.","methods":{"WETH()":{"notice":"Wrapped native token used by wrap and unwrap commands."},"IS_ROOT()":{"notice":"Whether this deployment is the root chain, where `VotingEscrow` and the Relay exist."},"constructor":{"notice":"Initializes the Metarouter."},"msgSender()":{"notice":"Returns the account whose positions and approvals commands act for."},"ICA_ROUTER()":{"notice":"Interchain account router used by the cross-chain commands to derive accounts and dispatch commitments."},"LEAF_VOTER()":{"notice":"Leaf Voter used to validate gauge targets and resolve their reward contracts."},"NATIVE_ERC20()":{"notice":"ERC20 entry point of the chain's native asset, on chains where one exists; the zero address elsewhere."},"STAKING_TOKEN()":{"notice":"Token `CREATE_STAKE` stakes into a new sAERO, resolved from `STAKING_ESCROW.TOKEN()`; zero on a leaf."},"EMISSION_TOKEN()":{"notice":"Token delivered to recipients by a gauge-emissions claim on this chain: the `ReceiptToken` on leaf         deployments, or the canonical `TOKEN` on root, where the receipt is redeemed for `TOKEN` in the same         transaction."},"STAKING_ESCROW()":{"notice":"VotingEscrow that `CREATE_STAKE` and `DEPOSIT_RELAY` act on, resolved from the root Voter's         `VOTING_ESCROW()`; the zero address on a leaf deployment."},"FACTORY_REGISTRY()":{"notice":"Registry used to authenticate pools, target factories, and gauge-to-factory relationships."},"NATIVE_ERC20_SCALE()":{"notice":"Native value represented by one raw unit of the native ERC20, derived from the token's decimals."},"RELAY_FACTORY_REGISTRY()":{"notice":"RelayFactoryRegistry that `DEPOSIT_RELAY` authenticates a caller-selected relay's factory against; the         zero address on a leaf deployment, where the command is gated off."},"execute(bytes,bytes[],uint256)":{"notice":"Runs an ordered command batch as one atomic call."},"uniswapV3SwapCallback(int256,int256,bytes)":{"notice":"Pays the input token owed to the currently authenticated CL pool."}},"version":1},"devdoc":{"kind":"dev","title":"Metarouter","errors":{"NotLeaf(uint256)":[{"params":{"_commandType":"Command ID that is leaf-only."}}],"NotRoot(uint256)":[{"params":{"_commandType":"Command ID that is root-only."}}],"InvalidPips(uint256)":[{"params":{"_pips":"Pip value that exceeded the 100% denominator."}}],"InvalidPool(address)":[{"params":{"_pool":"Invalid pool address."}}],"CommandDisabled(uint256)":[{"params":{"_commandType":"Command ID that is disabled on this deployment."}}],"InvalidReserves(address)":[{"params":{"_pool":"Pool with invalid reserves."}}],"PoolTokenMismatch(address)":[{"params":{"_pool":"Resolved pool address."}}],"CallbackNotCleared(address)":[{"params":{"_pool":"Pool still stored as the expected callback caller."}}],"InvalidCommandType(uint256)":[{"params":{"_commandType":"Undefined command ID that was dispatched."}}],"NativeTransferFailed(bytes)":[{"params":{"_data":"Revert data returned by the failed low-level call."}}],"InsufficientBalance(address)":[{"params":{"_asset":"ERC20 address, or address(0) for native ETH."}}],"InvalidCallbackCaller(address)":[{"params":{"_caller":"Unauthorized callback caller."}}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC-20 token failed."}],"TooLittleReceived(uint256,uint256)":[{"params":{"_minimum":"Minimum output requested.","_received":"Actual output received."}}],"UnsupportedBridgeFeeToken(address)":[{"params":{"_token":"Address of the unsupported fee token."}}],"PositionManagerNotConfigured(address)":[{"params":{"_factory":"Factory whose position manager is unset."}}],"BridgeQuoteExceedsBudget(uint256,uint256)":[{"params":{"_quote":"Native total the route quotes for the reduced bridge amount.","_budget":"Native budget resolved for the bridge."}}],"InsufficientLiquidityMinted(uint256,uint256)":[{"params":{"_minted":"LP tokens minted by the pool.","_minimum":"Minimum LP tokens requested by the caller."}}],"GaugeFactoryMismatch(address,address,address)":[{"params":{"_gauge":"Gauge whose factory identity is inconsistent.","_recordedFactory":"Gauge factory recorded by the FactoryRegistry.","_reportedFactory":"Gauge factory reported by the gauge itself."}}],"PositionManagerFactoryMismatch(address,address)":[{"params":{"_factory":"Factory that named the manager.","_positionManager":"Position manager that failed the reverse-link check."}}]},"events":{"BatchExecuted(address)":{"params":{"_sender":"Logical sender that owned the completed batch."}}},"details":"Virtual functions allow future variants to inherit from this contract and override selected behavior.","methods":{"constructor":{"params":{"_weth":"Wrapped native token used by payment commands. Zero on a chain with no wrapped-native token, where        `WRAP_ETH` and `UNWRAP_WETH` revert with `CommandDisabled`. Never the native ERC20.","_icaRouter":"Interchain account router used by the cross-chain commands. Zero on a lite deployment with no        cross-chain layer, where every command that derives an interchain account is disabled.","_leafVoter":"Leaf Voter used to validate gauge targets and, on leaf, to resolve the emission `ReceiptToken`.        Zero on a lite deployment with no voting system, where the gauge staking and claim commands are disabled.","_rootVoter":"Root Voter used only on root to resolve the emission token and the staking escrow; unused on leaf.","_nativeErc20":"ERC20 entry point of the chain's native asset, whose spend resolution and closing sweep are        capped so they cannot drain the pre-batch native balance. Zero on a chain whose native asset has no ERC20        entry point. A nonzero native ERC20 must report its decimals: the native-to-token scale is derived from        them, so a native ERC20 expressing the native asset in fewer decimals than native's eighteen converts correctly.","_factoryRegistry":"Registry used to authenticate recorded pools and CL factories, require factory approval        for pool creation, and resolve permanent factory relationships backing position managers.","_relayFactoryRegistry":"RelayFactoryRegistry used only on root to authenticate `DEPOSIT_RELAY` relays through        their factory; unused on leaf."},"details":"The emission token and the staking escrow are derived from the protocol, not passed. On root (this chain      equals the leaf voter's orchestrator `ROOT_CHAIN_ID`) the emission token is the root Voter's `MINTER().TOKEN()`      and the staking escrow is the root Voter's `VOTING_ESCROW()`, the canonical escrow `CREATE_STAKE` and      `DEPOSIT_RELAY` act on; on leaf the emission token is the leaf voter's `RECEIPT_TOKEN` and the staking      immutables stay zero. Derived values come from protocol contracts that validate them at their own      construction, so only the constructor's own inputs are zero-checked here.      A lite deployment ships without the voting system and without the cross-chain layer, so `_leafVoter` and      `_icaRouter` may be zero. A zero voter makes `IS_ROOT` false, leaves the emission token zero, and disables the      gauge staking and claim commands; a zero ICA router disables `EXECUTE_CROSS_CHAIN` and the `BRIDGE_TOKEN`      path that derives a destination interchain account. Those revert with `CommandDisabled` when dispatched,      while a `BRIDGE_TOKEN` naming a direct recipient stays available."},"msgSender()":{"returns":{"_sender":"Logical sender for the current batch."}},"execute(bytes,bytes[],uint256)":{"params":{"_inputs":"ABI-encoded arguments for each command.","_commands":"One byte per command, index-aligned with `_inputs`.","_deadline":"Timestamp after which the batch reverts."}},"uniswapV3SwapCallback(int256,int256,bytes)":{"params":{"_data":"Callback payer and input authorization encoded by the active swap command.","_amount0Delta":"Signed token0 amount owed to or sent by the pool.","_amount1Delta":"Signed token1 amount owed to or sent by the pool."}},"onERC721Received(address,address,uint256,bytes)":{"details":"Accepts a position only while a batch is active, and only when the calling collection, the sender, and the      position all match what the active command set through `MetarouterState.setExpectedNft`, then records the      `(collection, tokenId)` pair for the closing ownership check. A CL gauge returns unstaked positions through      `safeTransferFrom`, which is why the router implements the receiver.      This check is the custody boundary. A tracked position is one later commands may operate, so accepting an      unsolicited transfer would let a third party hand the active batch authority over a position it never asked      for. An unset slot reads zero and is rejected outright rather than compared, so a hook call reporting a zero      `_from` cannot slip through while the router expects nothing. Matching the token id too keeps a misbehaving      gauge from returning a different position than the one the command asked back.      The collection is matched rather than compared against a canonical manager: the router holds none, so each      command publishes the manager it resolved. Every argument here except `msg.sender` is chosen by the caller, so      without that comparison any contract could present the expected sender and token id and be recorded as a      custodied collection, and a position from one manager could satisfy state armed for another that issued the      same id."}},"version":1,"stateVariables":{"WETH":{"return":"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled.","returns":{"_0":"The wrapped native token, or the zero address on a chain with no wrapped-native token, where         `WRAP_ETH` and `UNWRAP_WETH` are disabled."}},"IS_ROOT":{"return":"True on the root deployment, false on a leaf.","details":"Gates the root-only `CREATE_STAKE` and `DEPOSIT_RELAY` commands; derived at construction from whether the      local chain id equals the orchestrator's `ROOT_CHAIN_ID`.","returns":{"_0":"True on the root deployment, false on a leaf."}},"ICA_ROUTER":{"return":"The interchain account router.","details":"The zero address on a lite deployment with no cross-chain layer, where every command that derives an      interchain account reverts with `CommandDisabled`. A `BRIDGE_TOKEN` naming a direct recipient never reads      this router, so it stays available there.","returns":{"_0":"The interchain account router."}},"LEAF_VOTER":{"return":"The leaf Voter.","details":"The zero address on a lite deployment with no voting system, where the gauge staking and claim commands      revert with `CommandDisabled`.","returns":{"_0":"The leaf Voter."}},"NATIVE_ERC20":{"return":"The native ERC20, or the zero address when the chain has none.","details":"The token's balance is the account's native balance expressed in the token's own decimals, so spend      resolution caps it at the batch's own native converted through `NATIVE_ERC20_SCALE`: spending the full      balance would drain the pre-batch native the batch must preserve and revert the closure.      The closing sweep skips its entry point entirely and returns the batch's portion through the native refund,      since some implementations reject a zero-value `transfer`; a recipient that rejects that refund is paid      through this entry point instead. On implementations that reject value-less transfers the ERC20-style      commands on this token revert mid-batch too; that is the token's own behavior, not the router's.      Never transfer or pre-fund this token ahead of `execute`: provide it as `msg.value` or pull it through      `FUND_ERC20` during the active batch. Value the router already holds when a batch opens counts as pre-batch      native, is excluded from batch custody, and cannot be recovered.","returns":{"_0":"The native ERC20, or the zero address when the chain has none."}},"STAKING_TOKEN":{"return":"The staking token, or the zero address on a leaf.","returns":{"_0":"The staking token, or the zero address on a leaf."}},"EMISSION_TOKEN":{"return":"The gauge-emissions token this router custodies and sweeps.","returns":{"_0":"The gauge-emissions token this router custodies and sweeps."}},"STAKING_ESCROW":{"return":"The VotingEscrow, or the zero address on a leaf.","returns":{"_0":"The VotingEscrow, or the zero address on a leaf."}},"FACTORY_REGISTRY":{"return":"Factory registry used by venue-sensitive commands.","returns":{"_0":"Factory registry used by venue-sensitive commands."}},"NATIVE_ERC20_SCALE":{"return":"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20.","details":"Some chains express the same native asset in different precisions per interface: eighteen decimals for      `address.balance` and `msg.value`, the token's own decimals for `balanceOf` and `transfer`. Every place      that mixes the two representations converts through this factor: the batch's spendable native — less any      committed message fee — converts to the native ERC20 decimals rounding down, so a full spend can never reach the      pre-batch native; a native refund paid through the native ERC20 also floors, leaving dust the token cannot      express. One on an eighteen-decimal native ERC20, where both interfaces share raw values.","returns":{"_0":"Native value per raw native ERC20 unit, or zero when the chain has no native ERC20."}},"RELAY_FACTORY_REGISTRY":{"return":"The RelayFactoryRegistry, or the zero address on a leaf.","returns":{"_0":"The RelayFactoryRegistry, or the zero address on a leaf."}}}},"storageLayout":{"types":null,"storage":[]},"transientStorageLayout":{"types":null,"storage":[]},"evm":{"bytecode":{"object":"61020060405230608052348015610014575f5ffd5b50604051615f5e380380615f5e833981016040819052610033916104ea565b6001600160a01b03821661005a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0380881660a05286811660c052848116610100528281166101205281166101c08190521561015f57806001600160a01b0316876001600160a01b0316036100bb576040516367472e0f60e11b815260040160405180910390fd5b5f816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061011c9190610581565b905060128160ff161115610143576040516312d5a04560e01b815260040160405180910390fd5b61014e8160126105bc565b61015990600a6106be565b6101e052505b6001600160a01b038616158015906102345750856001600160a01b031663c885f95a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101ae573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101d291906106cc565b6001600160a01b0316638acfcaf76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061023191906106e7565b46145b1580156101405261044b576001600160a01b0385166102665760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03831661028d5760405163d92e233d60e01b815260040160405180910390fd5b846001600160a01b031663fe6d81246040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102c9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ed91906106cc565b6001600160a01b03166382bfefc86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610328573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061034c91906106cc565b6001600160a01b031660e0816001600160a01b031681525050846001600160a01b0316631f87f3336040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103a1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c591906106cc565b6001600160a01b031661016081905260408051631057fdf960e31b815290516382bfefc8916004808201926020929091908290030181865afa15801561040d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061043191906106cc565b6001600160a01b039081166101805283166101a0526104c7565b6001600160a01b038616156104c757856001600160a01b0316633416919b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610496573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104ba91906106cc565b6001600160a01b031660e0525b505050505050506106fe565b6001600160a01b03811681146104e7575f5ffd5b50565b5f5f5f5f5f5f5f60e0888a031215610500575f5ffd5b875161050b816104d3565b602089015190975061051c816104d3565b604089015190965061052d816104d3565b606089015190955061053e816104d3565b608089015190945061054f816104d3565b60a0890151909350610560816104d3565b60c0890151909250610571816104d3565b8091505092959891949750929550565b5f60208284031215610591575f5ffd5b815160ff811681146105a1575f5ffd5b9392505050565b634e487b7160e01b5f52601160045260245ffd5b60ff82811682821603908111156105d5576105d56105a8565b92915050565b6001815b6001841115610616578085048111156105fa576105fa6105a8565b600184161561060857908102905b60019390931c9280026105df565b935093915050565b5f8261062c575060016105d5565b8161063857505f6105d5565b816001811461064e576002811461065857610674565b60019150506105d5565b60ff841115610669576106696105a8565b50506001821b6105d5565b5060208310610133831016604e8410600b8410161715610697575081810a6105d5565b6106a35f1984846105db565b805f19048211156106b6576106b66105a8565b029392505050565b5f6105a160ff84168361061e565b5f602082840312156106dc575f5ffd5b81516105a1816104d3565b5f602082840312156106f7575f5ffd5b5051919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e05161569c6108c25f395f818161023201528181610e6b0152818161110001526111a701525f81816102a601528181610dc501528181610e1801528181610f1e0152818161109a015261113e01525f818161042e01526125f901525f8181610192015261250101525f81816102d9015281816124df01526125d701525f81816103b8015281816123420152818161243b015261253301525f818161046101528181611aa701528181611b2301528181611b9f01528181611c1b01528181611c9701528181611d1301528181611d8f01528181611e9001528181611fb3015281816120d601528181612152015261402401525f818161031f015281816121ce0152818161220001526122ad01525f818161027301528181611f91015281816120b4015261240901525f818161035201528181611dc101528181611e6e01528181611ec201528181611f6f01528181611fe501528181612092015281816122df01526123e701525f818160f70152818161038501528181611847015281816118f40152818161192601526119d301525f610b14015261569c5ff3fe6080604052600436106100e7575f3560e01c80637286c0a611610087578063d737d0c711610057578063d737d0c7146103ea578063ee1e230d1461041d578063f1cefec214610450578063fa461e3314610483575f5ffd5b80637286c0a61461030e578063972ce39614610341578063ad5c464814610374578063c001b76d146103a7575f5ffd5b806327165e2e116100c257806327165e2e1461026257806327d973b41461029557806332218a6c146102c85780633593564c146102fb575f5ffd5b80630479d64414610181578063150b7a02146101d157806322c740c114610221575f5ffd5b3661017d57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480159061014457507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c155b1561017b576040517f38bbd57600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f5ffd5b34801561018c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101dc575f5ffd5b506101f06101eb3660046149f2565b6104a2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c8565b34801561022c575f5ffd5b506102547f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101c8565b34801561026d575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a0575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d3575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b61017b610309366004614a60565b6106a9565b348015610319575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561034c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561037f575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156103b2575f5ffd5b506103da7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016101c8565b3480156103f5575f5ffd5b507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6101b4565b348015610428575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561045b575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561048e575f5ffd5b5061017b61049d366004614b03565b610815565b5f7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5f036104fd576040517fb5cf512a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5c7f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075c7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315c6001600160a01b0382166105a3576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038416146105e5576040517f1b532e9b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316886001600160a01b031614610630576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808714610669576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610671610a0c565b61067b3388610a8c565b507f150b7a020000000000000000000000000000000000000000000000000000000098975050505050505050565b6106b1610b09565b8382146106ea576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80421115610724576040517f203d82d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c1561079557333014610784576040517f6f5ffb7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61079085858585610b6b565b610809565b61079d610d66565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6107cb86868686610b6b565b6107d481610e8f565b6040516001600160a01b038216907f99e0904407d080d7df635d4f68017fa5eb20cfbb1e51c1a6259a218eae490bc1905f90a2505b5050505050565b905090565b61081d610b09565b7f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b0381163314610888576040517fabae80280000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b6108b27f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5f61137d565b5f8086139085138082036108f2576040517f49133b7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f826108fe5786610900565b875b90505f61090f86880188614d0e565b6040810151909150156109ae575f81604001805161092c90614e0a565b908181525090506109a1825f0151828151811061094b5761094b614e1f565b60200260200101518360200151838151811061096957610969614e1f565b60200260200101518561097b90614e4c565b338660405160200161098d9190614ebe565b604051602081830303815290604052611384565b5050505050505050610a06565b8060a001518211156109ec576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a00816060015182608001513385611552565b50505050505b50505050565b610a367f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5f61137d565b610a607f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075f61137d565b610a8a7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315f61137d565b565b5f610a978383611607565b9050805c15610aa557505050565b610ab081600161137d565b610ada7fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461166a565b610b047f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68361166a565b505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a8a576040517f8de9ad8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b825f5b81811015610d5e575f5f610bc9888885818110610b8d57610b8d614e1f565b9050013560f81c60f81b60f881901c607f16917f8000000000000000000000000000000000000000000000000000000000000000909116151590565b9150915080610c0457610bff82878786818110610be857610be8614e1f565b9050602002810190610bfa9190614f80565b611695565b610d54565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f884901b1660208201525f9060210160408051808303601f19018152600180845283830190925292505f9190816020015b6060815260200190600190039081610c5a579050509050878786818110610c8357610c83614e1f565b9050602002810190610c959190614f80565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250855186945090925015159050610cdc57610cdc614e1f565b60209081029190910101526040517f3593564c0000000000000000000000000000000000000000000000000000000081523090633593564c90610d2890859085905f199060040161500f565b5f604051808303815f87803b158015610d3f575f5ffd5b505af1925050508015610d50575060015b5050505b5050600101610b6e565b505050505050565b610d907f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d3361137d565b610dc37ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc58610dbe344761508d565b61137d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610a8a57610e457fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b27f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661137d565b610a8a7fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55617f000000000000000000000000000000000000000000000000000000000000000061137d565b5f610eb97fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd7735612656565b90505f5b81811015611003575f610ef07fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77358361265e565b9050610f1c7f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac782612673565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610f5b5750610ffb565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610fb8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdc91906150a0565b90508015610ff857610ff86001600160a01b0383168683612682565b50505b600101610ebd565b5061102d7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77356126d0565b5f6110366126dd565b90505f81156111d2575f5f856001600160a01b0316846040515f6040518083038185875af1925050503d805f8114611089576040519150601f19603f3d011682016040523d82523d5f602084013e61108e565b606091505b5091509150816111cf577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110fa57806040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b5f6111257f0000000000000000000000000000000000000000000000000000000000000000866150f6565b90505f8111801561116757506111656001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016888361274c565b155b156111a057816040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b6111cb60017f000000000000000000000000000000000000000000000000000000000000000061508d565b9350505b50505b806111db6126dd565b1115611213576040517f60c79e6900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61121c612763565b90505f5b81811015611324575f5f6112338361278d565b9150915061124182826127ec565b61124c57505061131c565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa9250505080156112c6575060408051601f3d908101601f191682019092526112c39181019061512e565b60015b1561130f57306001600160a01b0382160361130d576040517fd30e2b5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6113198282612807565b50505b600101611220565b5061132d61281a565b6113577ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585f61137d565b6108097f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5f5b80825d5050565b5f807f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b038116156113f4576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161087f565b6114277f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c896001600160a01b031661137d565b5f876114475773fffd8963efd1fc6a506488495d951d5263988d2561144e565b6401000276a45b6040517f128acb080000000000000000000000000000000000000000000000000000000081529091506001600160a01b038a169063128acb089061149e9089908c908c9087908c90600401615149565b60408051808303815f875af11580156114b9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114dd9190615192565b90945092507f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c15611546576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038a16600482015260240161087f565b50509550959350505050565b306001600160a01b038416036115725761156d84838361286c565b610a06565b6001600160a01b03831615806115bb57507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6001600160a01b0316836001600160a01b031614155b156115f2576040517f8eb5b89100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a066001600160a01b03851684848461290b565b604080516001600160a01b03841660208201529081018290527f8d303e8787b8b7c55b97cfe6cd669d7c86fa2957639fd61f37cd6dbc0fbcb63b60608201525f906080016040516020818303038152906040528051906020012090505b92915050565b5f61167483612656565b90505f611681848361295a565b905082815d610a0684610dbe8460016151b4565b826116a457610b048282612991565b600183036116b657610b048282612ce6565b600883036116c857610b048282612f29565b600983036116da57610b048282613569565b602183036116ec57610b048282613a7f565b600e83036116fe57610b048282613b3d565b60048303611789576040517f738281980000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063738281989061175890859085906004016151f0565b5f6040518083038186803b15801561176e575f5ffd5b505af4158015611780573d5f5f3e3d5ffd5b50505050505050565b600583036117e3576040517f066cfad10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063066cfad19061175890859085906004016151f0565b600f830361183d576040517fb1fe6fd10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063b1fe6fd19061175890859085906004016151f0565b600b830361191c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166118a8576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f1fe8554200000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631fe855429061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b600c83036119fb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611987576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f704c288a0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063704c288a9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60348303611a53576040517e15460000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090621546009061175890859085906004016151f0565b60248303611acf576040517fa4dbb3b10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063a4dbb3b19061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60258303611b4b576040517f09257a65000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906309257a659061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60268303611bc7576040517f1a8ba09b00000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631a8ba09b9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60278303611c43576040517fcc08716e0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cc08716e9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60288303611cbf576040517f9baecc4800000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090639baecc489061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60228303611d3b576040517f3bba852300000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090633bba85239061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60238303611db7576040517fc58512f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063c58512f69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60298303611eb8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611e22576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f47af55b3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906347af55b39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b602a8303611fdb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611f23576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fcea3f4ff0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cea3f4ff9061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602d83036120fe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612046576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f84acbbb3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906384acbbb39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602f830361217a576040517fdce507bc0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063dce507bc9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601283036121f6576040517f852495f70000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063852495f79061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601383036122d5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612261576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7707d3b600000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637707d3b69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60148303612431577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612340576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b7f00000000000000000000000000000000000000000000000000000000000000001561239b576040517f1ce431f30000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7b232fa100000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637b232fa19061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60308303612529577f0000000000000000000000000000000000000000000000000000000000000000612493576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f8b08833000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090638b0883309061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60328303612621577f000000000000000000000000000000000000000000000000000000000000000061258b576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fef0607f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063ef0607f69061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b6040517fd76a1e9e0000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b5f815c611664565b5f5f61266a848461295a565b5c949350505050565b61267e82825f613c78565b5050565b61268f8383836001613c8a565b610b04576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b6126da815f61137d565b50565b5f477ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585c8082101561273b576040517f53dad58300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612745818361508d565b9250505090565b5f6127598484845f613c8a565b90505b9392505050565b5f6108107fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e2612656565b5f5f6127b97fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461265e565b91506127e57f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68461265e565b9050915091565b5f6127fe6127fa8484611607565b5c90565b15159392505050565b61267e6128148383611607565b5f61137d565b6128437fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e26126d0565b610a8a7f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b66126d0565b7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316836001600160a01b03161480156128b557506128b283613d05565b81115b156128f7576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b610b046001600160a01b0384168383612682565b612919848484846001613df3565b610a06576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b5f818360405160200161296f91815260200190565b604051602081830303815290604052805190602001205f1c61275c91906151b4565b5f61299e828401846152a0565b9050806060015180156129c757505f60408201515160018111156129c4576129c46153ae565b14155b156129fe576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612a18835f0151846020015160018660a00151613e79565b8451516060860151929450909250905f90612a4557612a40856020015186604001515f6144ef565b612a4f565b8460400151602001515b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612aab576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8560600151612abb5730612ade565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b604080515f80825260208201818152828401909352929350915b85811015612c8b575f86612b0d8360016151b4565b14612b185730612b1e565b8960a001515b9050306001600160a01b03821603612b5c57612b5c89612b3f8460016151b4565b81518110612b4f57612b4f614e1f565b6020026020010151614676565b5f6040518060c001604052808681526020018581526020015f81526020018b8581518110612b8c57612b8c614e1f565b60200260200101516001600160a01b03168152602001876001600160a01b031681526020018881525090505f5f612c068d5f01518681518110612bd157612bd1614e1f565b60200260200101518c8781518110612beb57612beb614e1f565b60200260200101518b878760405160200161098d9190614ebe565b915091505f8b8681518110612c1d57612c1d614e1f565b6020026020010151612c2f5782612c31565b815b90505f811315612c6d576040517f62f708cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c7681614e4c565b99503098505050505050806001019050612af8565b508760800151841015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810185905260440161087f565b50505050505050505050565b5f612cf3828401846153db565b90505f5f612d0f835f0151846020015160018660a00151613e79565b915091505f6001845f015151612d25919061508d565b9050306001600160a01b03168460a001516001600160a01b031603612d5357612d5383612b3f8360016151b4565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84604001511115612db1576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8460600151612dc15730612de4565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508460600151612dfc57612dfc8560200151614676565b5f6040518060c00160405280875f0151815260200185815260200184815260200187602001516001600160a01b03168152602001836001600160a01b03168152602001876080015181525090505f5f612ea9885f01518681518110612e6357612e63614e1f565b6020026020010151878781518110612e7d57612e7d614e1f565b60200260200101518a60400151612e9390614e4c565b8b60a001518760405160200161098d9190614ebe565b915091505f868681518110612ec057612ec0614e1f565b6020026020010151612ed25782612ed4565b815b9050886040015181612ee590614e4c565b14612f1c576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b5f612f36828401846152a0565b905080606001518015612f5f57505f6040820151516001811115612f5c57612f5c6153ae565b14155b15612f96576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612faf835f015184602001515f8660a00151613e79565b915091505f835f01515190505f838281518110612fce57612fce614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b031603612ffe57612ffe81614676565b5f85606001516130205761301b866020015187604001515f6144ef565b61302a565b8560400151602001515b9050613086866020015187606001516130435730613066565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b885180515f9061307857613078614e1f565b602002602001015184611552565b5f805b84811015613483575f5f5f8a5f015184815181106130a9576130a9614e1f565b60200260200101516001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156130ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131109190615498565b50915091505f89858151811061312857613128614e1f565b602002602001015161313a578161313c565b825b90505f8b868151811061315157613151614e1f565b60200260200101516001600160a01b03166370a082318e5f0151888151811061317c5761317c614e1f565b60200260200101516040518263ffffffff1660e01b81526004016131af91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156131ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ee91906150a0565b905081811015613256578c5180518790811061320c5761320c614e1f565b60200260200101516040517f6cda144000000000000000000000000000000000000000000000000000000000815260040161087f91906001600160a01b0391909116815260200190565b613260828261508d565b9450505050505f895f0151838151811061327c5761327c614e1f565b60200260200101516001600160a01b0316630ea099c1838b86815181106132a5576132a5614e1f565b60200260200101516040518363ffffffff1660e01b81526004016132dc9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa1580156132f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331b91906150a0565b90505f8761332a8560016151b4565b101561335c578a5161333d8560016151b4565b8151811061334d5761334d614e1f565b60200260200101519050613434565b8a608001518210156133aa5760808b01516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810183905260440161087f565b5060a08a01516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528816906370a0823190602401602060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061343191906150a0565b94505b6134758b5f0151858151811061344c5761344c614e1f565b60200260200101518a868151811061346657613466614e1f565b602002602001015184846146c1565b505050806001019050613089565b5060a08701516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908616906370a0823190602401602060405180830381865afa1580156134eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061350f91906150a0565b613519919061508d565b90508760800151811015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810182905260440161087f565b5f613576828401846153db565b90505f5f613591835f015184602001515f8660a00151613e79565b915091505f835f01515190505f8382815181106135b0576135b0614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b0316036135e0576135e081614676565b5f6135ec8360016151b4565b67ffffffffffffffff81111561360457613604614b52565b60405190808252806020026020018201604052801561362d578160200160208202803683370190505b509050856040015181848151811061364757613647614e1f565b6020908102919091010152825b801561376d5761366381614e0a565b9050865f0151818151811061367a5761367a614e1f565b60200260200101516001600160a01b031663b95d88f88383600161369e91906151b4565b815181106136ae576136ae614e1f565b6020026020010151888460016136c491906151b4565b815181106136d4576136d4614e1f565b60200260200101516040518363ffffffff1660e01b815260040161370b9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa158015613726573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061374a91906150a0565b82828151811061375c5761375c614e1f565b602002602001018181525050613654565b508560800151815f8151811061378557613785614e1f565b602002602001015111156137c5576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f86606001516137d557306137f8565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508660600151613810576138108760200151614676565b613855876020015182895f01515f8151811061382e5761382e614e1f565b6020026020010151855f8151811061384857613848614e1f565b6020026020010151611552565b5f805b85811015613998575f8661386d8360016151b4565b101561389f5789516138808360016151b4565b8151811061389057613890614e1f565b60200260200101519050613929565b5060a08901516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528716906370a0823190602401602060405180830381865afa158015613902573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061392691906150a0565b92505b61398f8a5f0151838151811061394157613941614e1f565b602002602001015189848151811061395b5761395b614e1f565b60200260200101518785600161397191906151b4565b8151811061398157613981614e1f565b6020026020010151846146c1565b50600101613858565b5060a08801516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908716906370a0823190602401602060405180830381865afa158015613a00573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a2491906150a0565b613a2e919061508d565b90508860400151811015612f1c578860400151816040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260040161087f929190918252602082015260400190565b5f80613a8d8385018561552f565b6040517f3593564c00000000000000000000000000000000000000000000000000000000815291935091503090633593564c90613ad390859085905f199060040161500f565b5f604051808303815f87803b158015613aea575f5ffd5b505af1925050508015613afb575060015b610a06573d808015613b28576040519150601f19603f3d011682016040523d82523d5f602084013e613b2d565b606091505b50613b378161475f565b50610a06565b5f8080613b4c8486018661560d565b919450925090505f6001600160a01b038416613b91576001600160a01b0383163014613b8257826001600160a01b031631613b8a565b613b8a6126dd565b9050613c33565b6001600160a01b0383163014613c27576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa158015613bfe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c2291906150a0565b613c30565b613c3084613d05565b90505b81811015610d5e576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b815f52826020528060405f205d505050565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316613cf9578383151615613ced573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b5f7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316826001600160a01b031603613d74577fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55615c613d6a6126dd565b61166491906150f6565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015613dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061166491906150a0565b6040517f23b872dd000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f51148316613e68578383151615613e5c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b6060806001600160a01b038316613ebc576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85515f819003613ef8576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613f038160016151b4565b67ffffffffffffffff811115613f1b57613f1b614b52565b604051908082528060200260200182016040528015613f44578160200160208202803683370190505b5092508067ffffffffffffffff811115613f6057613f60614b52565b604051908082528060200260200182016040528015613f89578160200160208202803683370190505b50915085835f81518110613f9f57613f9f614e1f565b60200260200101906001600160a01b031690816001600160a01b0316815250505f5b818110156144e4575f888281518110613fdc57613fdc614e1f565b60209081029190910101516040517fe3152b4c0000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301529192505f917f0000000000000000000000000000000000000000000000000000000000000000169063e3152b4c90602401602060405180830381865afa158015614069573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061408d919061512e565b90506001600160a01b0381166140da576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b6040517f5b16ebb70000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152821690635b16ebb790602401602060405180830381865afa158015614137573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061415b919061564b565b61419c576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b5f826001600160a01b031663648da8596040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141fd91906150a0565b9050881561426e577f434c0000000000000000000000000000000000000000000000000000000000008114614269576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b614300565b7f56325f564f4c4154494c4500000000000000000000000000000000000000000081141580156142be57507f56325f535441424c4500000000000000000000000000000000000000000000008114155b15614300576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b5f5f846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561433e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614362919061512e565b856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143c2919061512e565b915091505f826001600160a01b03168a88815181106143e3576143e3614e1f565b60200260200101516001600160a01b0316149050801580156144305750816001600160a01b03168a888151811061441c5761441c614e1f565b60200260200101516001600160a01b031614155b15614467576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8089888151811061447a5761447a614e1f565b91151560209283029190910190910152806144955782614497565b815b8a6144a38960016151b4565b815181106144b3576144b3614e1f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050505050806001019050613fc1565b505094509492505050565b5f8115614665575f8351600181111561450a5761450a6153ae565b14614541576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038616906370a0823190602401602060405180830381865afa15801561459e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145c291906150a0565b90506145d2858560200151614767565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa15801561462f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061465391906150a0565b61465d919061508d565b91505061275c565b61466f84846147a6565b905061275c845b6126da7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77357f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac7836147ba565b5f5f846146cf57835f6146d2565b5f845b6040517f022c0d9f00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526001600160a01b038681166044830152608060648301525f60848301529294509092509087169063022c0d9f9060a4015f604051808303815f87803b15801561474d575f5ffd5b505af1158015612cda573d5f5f3e3d5ffd5b805160208201fd5b61477082614676565b61267e6001600160a01b0383167f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c308461290b565b5f61275c836147b485613d05565b846147e8565b5f8181526020839052604090205c156147d257505050565b6147de82826001613c78565b610b04838261166a565b5f80825160018111156147fd576147fd6153ae565b0361485657828260200151111561484b576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b50602081015161275c565b620f42408260200151111561489f5781602001516040517f966987d500000000000000000000000000000000000000000000000000000000815260040161087f91815260200190565b612759838360200151620f42405f5f5f6148b9868661495c565b91509150815f036148dd578381816148d3576148d36150c9565b049250505061275c565b8184116148f4576148f46003851502601118614978565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b6001600160a01b03811681146126da575f5ffd5b80356149a881614989565b919050565b5f5f83601f8401126149bd575f5ffd5b50813567ffffffffffffffff8111156149d4575f5ffd5b6020830191508360208285010111156149eb575f5ffd5b9250929050565b5f5f5f5f5f60808688031215614a06575f5ffd5b8535614a1181614989565b94506020860135614a2181614989565b935060408601359250606086013567ffffffffffffffff811115614a43575f5ffd5b614a4f888289016149ad565b969995985093965092949392505050565b5f5f5f5f5f60608688031215614a74575f5ffd5b853567ffffffffffffffff811115614a8a575f5ffd5b614a96888289016149ad565b909650945050602086013567ffffffffffffffff811115614ab5575f5ffd5b8601601f81018813614ac5575f5ffd5b803567ffffffffffffffff811115614adb575f5ffd5b8860208260051b8401011115614aef575f5ffd5b959894975060200195604001359392505050565b5f5f5f5f60608587031215614b16575f5ffd5b8435935060208501359250604085013567ffffffffffffffff811115614b3a575f5ffd5b614b46878288016149ad565b95989497509550505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715614ba257614ba2614b52565b60405290565b6040805190810167ffffffffffffffff81118282101715614ba257614ba2614b52565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bf457614bf4614b52565b604052919050565b5f67ffffffffffffffff821115614c1557614c15614b52565b5060051b60200190565b5f82601f830112614c2e575f5ffd5b8135614c41614c3c82614bfc565b614bcb565b8082825260208201915060208360051b860101925085831115614c62575f5ffd5b602085015b83811015614c88578035614c7a81614989565b835260209283019201614c67565b5095945050505050565b80151581146126da575f5ffd5b80356149a881614c92565b5f82601f830112614cb9575f5ffd5b8135614cc7614c3c82614bfc565b8082825260208201915060208360051b860101925085831115614ce8575f5ffd5b602085015b83811015614c88578035614d0081614c92565b835260209283019201614ced565b5f60208284031215614d1e575f5ffd5b813567ffffffffffffffff811115614d34575f5ffd5b820160c08185031215614d45575f5ffd5b614d4d614b7f565b813567ffffffffffffffff811115614d63575f5ffd5b614d6f86828501614c1f565b825250602082013567ffffffffffffffff811115614d8b575f5ffd5b614d9786828501614caa565b60208301525060408281013590820152614db36060830161499d565b6060820152614dc46080830161499d565b608082015260a091820135918101919091529392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f81614e1857614e18614ddd565b505f190190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f7f80000000000000000000000000000000000000000000000000000000000000008203614e7c57614e7c614ddd565b505f0390565b5f8151808452602084019350602083015f5b82811015614eb45781511515865260209586019590910190600101614e94565b5093949350505050565b6020808252825160c083830152805160e084018190525f92919091019082906101008501905b80831015614f10576001600160a01b038451168252602082019150602084019350600183019250614ee4565b5060208601519250601f19858203016040860152614f2e8184614e82565b92505050604084015160608401526060840151614f5660808501826001600160a01b03169052565b5060808401516001600160a01b03811660a08501525060a084015160c08401528091505092915050565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614fb3575f5ffd5b83018035915067ffffffffffffffff821115614fcd575f5ffd5b6020019150368190038213156149eb575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b606081525f6150216060830186614fe1565b828103602084015280855180835260208301915060208160051b840101602088015f5b8381101561507657601f19868403018552615060838351614fe1565b6020958601959093509190910190600101615044565b505080945050505050826040830152949350505050565b8181038181111561166457611664614ddd565b5f602082840312156150b0575f5ffd5b5051919050565b602081525f61275c6020830184614fe1565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82615129577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561513e575f5ffd5b815161275c81614989565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a060808201525f61518760a0830184614fe1565b979650505050505050565b5f5f604083850312156151a3575f5ffd5b505080516020909101519092909150565b8082018082111561166457611664614ddd565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f6127596020830184866151c7565b604081525f6152166040830185876151c7565b90506001600160a01b0383166020830152949350505050565b606081525f6152426060830186886151c7565b6001600160a01b039485166020840152929093166040909101529392505050565b608081525f6152766080830187896151c7565b6001600160a01b039586166020840152938516604083015250921660609092019190915292915050565b5f602082840312156152b0575f5ffd5b813567ffffffffffffffff8111156152c6575f5ffd5b820180840360e08112156152d8575f5ffd5b6152e0614b7f565b823567ffffffffffffffff8111156152f6575f5ffd5b61530287828601614c1f565b825250602083013561531381614989565b602082015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc083011215615347575f5ffd5b61534f614ba8565b9150604083013560028110615362575f5ffd5b8252606083013560208301526040810182905261538160808401614c9f565b606082015260a08301356080820181905291506153a060c0840161499d565b60a082015295945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f602082840312156153eb575f5ffd5b813567ffffffffffffffff811115615401575f5ffd5b820160c08185031215615412575f5ffd5b61541a614b7f565b813567ffffffffffffffff811115615430575f5ffd5b61543c86828501614c1f565b825250602082013561544d81614989565b602082015260408281013590820152606082013561546a81614c92565b60608201526080828101359082015260a0909101359061548982614989565b60a08101919091529392505050565b5f5f5f606084860312156154aa575f5ffd5b5050815160208301516040909301519094929350919050565b5f82601f8301126154d2575f5ffd5b813567ffffffffffffffff8111156154ec576154ec614b52565b6154ff6020601f19601f84011601614bcb565b818152846020838601011115615513575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215615540575f5ffd5b823567ffffffffffffffff811115615556575f5ffd5b615562858286016154c3565b925050602083013567ffffffffffffffff81111561557e575f5ffd5b8301601f8101851361558e575f5ffd5b803561559c614c3c82614bfc565b8082825260208201915060208360051b8501019250878311156155bd575f5ffd5b602084015b838110156155fe57803567ffffffffffffffff8111156155e0575f5ffd5b6155ef8a6020838901016154c3565b845250602092830192016155c2565b50809450505050509250929050565b5f5f5f6060848603121561561f575f5ffd5b833561562a81614989565b9250602084013561563a81614989565b929592945050506040919091013590565b5f6020828403121561565b575f5ffd5b815161275c81614c9256fea26469706673582212200b9b76d18116ba4fbcf799f853e027611cf243b1ac3e7152fe22d5efe86925cc64736f6c63430008240033","sourceMap":"2499:46257:41:-:0;;;3499:4;3446:58;;7241:2232;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;7488:39:41;;7484:65;;7536:13;;-1:-1:-1;;;7536:13:41;;;;;;;;;;;7484:65;-1:-1:-1;;;;;7555:12:41;;;;;7573:23;;;;;7602;;;;;7631:35;;;;;7672:27;;;;;;7709:35;7705:796;;7997:12;-1:-1:-1;;;;;7971:39:41;7979:5;-1:-1:-1;;;;;7971:39:41;;7967:71;;8019:19;;-1:-1:-1;;;8019:19:41;;;;;;;;;;;7967:71;8281:26;8333:12;-1:-1:-1;;;;;8310:46:41;;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8281:77;;8393:2;8370:20;:25;;;8366:66;;;8404:28;;-1:-1:-1;;;8404:28:41;;;;;;;;;;;8366:66;8468:25;8473:20;8468:2;:25;:::i;:::-;8461:33;;:2;:33;:::i;:::-;8440:54;;-1:-1:-1;7705:796:41;-1:-1:-1;;;;;8626:33:41;;;;;;:95;;;8680:10;-1:-1:-1;;;;;8680:23:41;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8680:39:41;;:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8663:13;:58;8626:95;8616:105;;;;;8728:741;;-1:-1:-1;;;;;8753:33:41;;8749:59;;8795:13;;-1:-1:-1;;;8795:13:41;;;;;;;;;;;8749:59;-1:-1:-1;;;;;8820:44:41;;8816:70;;8873:13;;-1:-1:-1;;;8873:13:41;;;;;;;;;;;8816:70;8918:10;-1:-1:-1;;;;;8918:17:41;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8918:25:41;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8894:52:41;;;-1:-1:-1;;;;;8894:52:41;;;;;8971:10;-1:-1:-1;;;;;8971:24:41;;:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;8954:43:41;;;;;9036:22;;;-1:-1:-1;;;9036:22:41;;;;:20;;:22;;;;;;;;;;;;;;;8954:43;9036:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;9005:55:41;;;;;9068:46;;;;8728:741;;;-1:-1:-1;;;;;9367:33:41;;;9363:99;;9434:10;-1:-1:-1;;;;;9434:24:41;;:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;9402:60:41;;;9363:99;7241:2232;;;;;;;2499:46257;;14:138:76;-1:-1:-1;;;;;96:31:76;;86:42;;76:70;;142:1;139;132:12;76:70;14:138;:::o;157:1260::-;433:6;441;449;457;465;473;481;534:3;522:9;513:7;509:23;505:33;502:53;;;551:1;548;541:12;502:53;583:9;577:16;602:38;634:5;602:38;:::i;:::-;709:2;694:18;;688:25;659:5;;-1:-1:-1;722:40:76;688:25;722:40;:::i;:::-;833:2;818:18;;812:25;781:7;;-1:-1:-1;846:40:76;812:25;846:40;:::i;:::-;957:2;942:18;;936:25;905:7;;-1:-1:-1;970:40:76;936:25;970:40;:::i;:::-;1081:3;1066:19;;1060:26;1029:7;;-1:-1:-1;1095:40:76;1060:26;1095:40;:::i;:::-;1206:3;1191:19;;1185:26;1154:7;;-1:-1:-1;1220:40:76;1185:26;1220:40;:::i;:::-;1331:3;1316:19;;1310:26;1279:7;;-1:-1:-1;1345:40:76;1310:26;1345:40;:::i;:::-;1404:7;1394:17;;;157:1260;;;;;;;;;;:::o;1422:273::-;1490:6;1543:2;1531:9;1522:7;1518:23;1514:32;1511:52;;;1559:1;1556;1549:12;1511:52;1591:9;1585:16;1641:4;1634:5;1630:16;1623:5;1620:27;1610:55;;1661:1;1658;1651:12;1610:55;1684:5;1422:273;-1:-1:-1;;;1422:273:76:o;1700:127::-;1761:10;1756:3;1752:20;1749:1;1742:31;1792:4;1789:1;1782:15;1816:4;1813:1;1806:15;1832:151;1922:4;1915:12;;;1901;;;1897:31;;1940:14;;1937:40;;;1957:18;;:::i;:::-;1832:151;;;;:::o;1988:375::-;2076:1;2094:5;2108:249;2129:1;2119:8;2116:15;2108:249;;;2179:4;2174:3;2170:14;2164:4;2161:24;2158:50;;;2188:18;;:::i;:::-;2238:1;2228:8;2224:16;2221:49;;;2252:16;;;;2221:49;2335:1;2331:16;;;;;2291:15;;2108:249;;;1988:375;;;;;;:::o;2368:902::-;2417:5;2447:8;2437:80;;-1:-1:-1;2488:1:76;2502:5;;2437:80;2536:4;2526:76;;-1:-1:-1;2573:1:76;2587:5;;2526:76;2618:4;2636:1;2631:59;;;;2704:1;2699:174;;;;2611:262;;2631:59;2661:1;2652:10;;2675:5;;;2699:174;2736:3;2726:8;2723:17;2720:43;;;2743:18;;:::i;:::-;-1:-1:-1;;2799:1:76;2785:16;;2858:5;;2611:262;;2957:2;2947:8;2944:16;2938:3;2932:4;2929:13;2925:36;2919:2;2909:8;2906:16;2901:2;2895:4;2892:12;2888:35;2885:77;2882:203;;;-1:-1:-1;2994:19:76;;;3070:5;;2882:203;3117:42;-1:-1:-1;;3142:8:76;3136:4;3117:42;:::i;:::-;3195:6;3191:1;3187:6;3183:19;3174:7;3171:32;3168:58;;;3206:18;;:::i;:::-;3244:20;;2368:902;-1:-1:-1;;;2368:902:76:o;3275:140::-;3333:5;3362:47;3403:4;3393:8;3389:19;3383:4;3362:47;:::i;3420:290::-;3522:6;3575:2;3563:9;3554:7;3550:23;3546:32;3543:52;;;3591:1;3588;3581:12;3543:52;3623:9;3617:16;3642:38;3674:5;3642:38;:::i;3715:184::-;3785:6;3838:2;3826:9;3817:7;3813:23;3809:32;3806:52;;;3854:1;3851;3844:12;3806:52;-1:-1:-1;3877:16:76;;3715:184;-1:-1:-1;3715:184:76:o;5009:290::-;2499:46257:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","linkReferences":{"V3/src/metarouter/libraries/ClaimsLib.sol":{"ClaimsLib":[{"start":10544,"length":20},{"start":10736,"length":20}]},"V3/src/metarouter/libraries/StakingLib.sol":{"StakingLib":[{"start":9996,"length":20},{"start":10253,"length":20}]},"V3/src/metarouter/libraries/PaymentsLib.sol":{"PaymentsLib":[{"start":8176,"length":20},{"start":8315,"length":20},{"start":8405,"length":20},{"start":8594,"length":20},{"start":8817,"length":20},{"start":8940,"length":20}]},"V3/src/metarouter/libraries/LiquidityLib.sol":{"LiquidityLib":[{"start":9649,"length":20},{"start":9773,"length":20}]},"V3/src/metarouter/libraries/ClPositionLib.sol":{"ClPositionLib":[{"start":9029,"length":20},{"start":9153,"length":20},{"start":9277,"length":20},{"start":9401,"length":20},{"start":9525,"length":20}]},"V3/src/metarouter/libraries/CrosschainLib.sol":{"CrosschainLib":[{"start":10860,"length":20},{"start":11083,"length":20},{"start":11397,"length":20}]},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"StakeRelayLib":[{"start":11645,"length":20},{"start":11893,"length":20}]}}},"deployedBytecode":{"object":"6080604052600436106100e7575f3560e01c80637286c0a611610087578063d737d0c711610057578063d737d0c7146103ea578063ee1e230d1461041d578063f1cefec214610450578063fa461e3314610483575f5ffd5b80637286c0a61461030e578063972ce39614610341578063ad5c464814610374578063c001b76d146103a7575f5ffd5b806327165e2e116100c257806327165e2e1461026257806327d973b41461029557806332218a6c146102c85780633593564c146102fb575f5ffd5b80630479d64414610181578063150b7a02146101d157806322c740c114610221575f5ffd5b3661017d57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480159061014457507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c155b1561017b576040517f38bbd57600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b005b5f5ffd5b34801561018c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156101dc575f5ffd5b506101f06101eb3660046149f2565b6104a2565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016101c8565b34801561022c575f5ffd5b506102547f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016101c8565b34801561026d575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a0575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d3575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b61017b610309366004614a60565b6106a9565b348015610319575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561034c575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561037f575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b3480156103b2575f5ffd5b506103da7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016101c8565b3480156103f5575f5ffd5b507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6101b4565b348015610428575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561045b575f5ffd5b506101b47f000000000000000000000000000000000000000000000000000000000000000081565b34801561048e575f5ffd5b5061017b61049d366004614b03565b610815565b5f7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5f036104fd576040517fb5cf512a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5c7f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075c7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315c6001600160a01b0382166105a3576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b038416146105e5576040517f1b532e9b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b816001600160a01b0316886001600160a01b031614610630576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808714610669576040517fc6e0973e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610671610a0c565b61067b3388610a8c565b507f150b7a020000000000000000000000000000000000000000000000000000000098975050505050505050565b6106b1610b09565b8382146106ea576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80421115610724576040517f203d82d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c1561079557333014610784576040517f6f5ffb7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61079085858585610b6b565b610809565b61079d610d66565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6107cb86868686610b6b565b6107d481610e8f565b6040516001600160a01b038216907f99e0904407d080d7df635d4f68017fa5eb20cfbb1e51c1a6259a218eae490bc1905f90a2505b5050505050565b905090565b61081d610b09565b7f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b0381163314610888576040517fabae80280000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b6108b27f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5f61137d565b5f8086139085138082036108f2576040517f49133b7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f826108fe5786610900565b875b90505f61090f86880188614d0e565b6040810151909150156109ae575f81604001805161092c90614e0a565b908181525090506109a1825f0151828151811061094b5761094b614e1f565b60200260200101518360200151838151811061096957610969614e1f565b60200260200101518561097b90614e4c565b338660405160200161098d9190614ebe565b604051602081830303815290604052611384565b5050505050505050610a06565b8060a001518211156109ec576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a00816060015182608001513385611552565b50505050505b50505050565b610a367f9c6ef97dd2926c3729bbadff508f54b6365e9bb1d602734781b9f357bb9673df5f61137d565b610a607f9019c09a61c39d139361b3184cbbfec3e3df74bf55faedcd139622d0cabfba075f61137d565b610a8a7f9de7561924bd960b99bd7f120f2a75040f4470cce04538d26828f6b02a89f2315f61137d565b565b5f610a978383611607565b9050805c15610aa557505050565b610ab081600161137d565b610ada7fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461166a565b610b047f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68361166a565b505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a8a576040517f8de9ad8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b825f5b81811015610d5e575f5f610bc9888885818110610b8d57610b8d614e1f565b9050013560f81c60f81b60f881901c607f16917f8000000000000000000000000000000000000000000000000000000000000000909116151590565b9150915080610c0457610bff82878786818110610be857610be8614e1f565b9050602002810190610bfa9190614f80565b611695565b610d54565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f884901b1660208201525f9060210160408051808303601f19018152600180845283830190925292505f9190816020015b6060815260200190600190039081610c5a579050509050878786818110610c8357610c83614e1f565b9050602002810190610c959190614f80565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250855186945090925015159050610cdc57610cdc614e1f565b60209081029190910101526040517f3593564c0000000000000000000000000000000000000000000000000000000081523090633593564c90610d2890859085905f199060040161500f565b5f604051808303815f87803b158015610d3f575f5ffd5b505af1925050508015610d50575060015b5050505b5050600101610b6e565b505050505050565b610d907f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d3361137d565b610dc37ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc58610dbe344761508d565b61137d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615610a8a57610e457fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b27f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661137d565b610a8a7fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55617f000000000000000000000000000000000000000000000000000000000000000061137d565b5f610eb97fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd7735612656565b90505f5b81811015611003575f610ef07fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77358361265e565b9050610f1c7f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac782612673565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603610f5b5750610ffb565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038316906370a0823190602401602060405180830381865afa158015610fb8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdc91906150a0565b90508015610ff857610ff86001600160a01b0383168683612682565b50505b600101610ebd565b5061102d7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77356126d0565b5f6110366126dd565b90505f81156111d2575f5f856001600160a01b0316846040515f6040518083038185875af1925050503d805f8114611089576040519150601f19603f3d011682016040523d82523d5f602084013e61108e565b606091505b5091509150816111cf577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110fa57806040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b5f6111257f0000000000000000000000000000000000000000000000000000000000000000866150f6565b90505f8111801561116757506111656001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016888361274c565b155b156111a057816040517fad9ba04a00000000000000000000000000000000000000000000000000000000815260040161087f91906150b7565b6111cb60017f000000000000000000000000000000000000000000000000000000000000000061508d565b9350505b50505b806111db6126dd565b1115611213576040517f60c79e6900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61121c612763565b90505f5b81811015611324575f5f6112338361278d565b9150915061124182826127ec565b61124c57505061131c565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa9250505080156112c6575060408051601f3d908101601f191682019092526112c39181019061512e565b60015b1561130f57306001600160a01b0382160361130d576040517fd30e2b5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b6113198282612807565b50505b600101611220565b5061132d61281a565b6113577ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585f61137d565b6108097f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5f5b80825d5050565b5f807f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c6001600160a01b038116156113f4576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161087f565b6114277f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c896001600160a01b031661137d565b5f876114475773fffd8963efd1fc6a506488495d951d5263988d2561144e565b6401000276a45b6040517f128acb080000000000000000000000000000000000000000000000000000000081529091506001600160a01b038a169063128acb089061149e9089908c908c9087908c90600401615149565b60408051808303815f875af11580156114b9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114dd9190615192565b90945092507f6e21e72601dc928816fbe7be1688a5ccae8bdb1b7ec94fa6319946549630de9c5c15611546576040517ff785a4050000000000000000000000000000000000000000000000000000000081526001600160a01b038a16600482015260240161087f565b50509550959350505050565b306001600160a01b038416036115725761156d84838361286c565b610a06565b6001600160a01b03831615806115bb57507f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c6001600160a01b0316836001600160a01b031614155b156115f2576040517f8eb5b89100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a066001600160a01b03851684848461290b565b604080516001600160a01b03841660208201529081018290527f8d303e8787b8b7c55b97cfe6cd669d7c86fa2957639fd61f37cd6dbc0fbcb63b60608201525f906080016040516020818303038152906040528051906020012090505b92915050565b5f61167483612656565b90505f611681848361295a565b905082815d610a0684610dbe8460016151b4565b826116a457610b048282612991565b600183036116b657610b048282612ce6565b600883036116c857610b048282612f29565b600983036116da57610b048282613569565b602183036116ec57610b048282613a7f565b600e83036116fe57610b048282613b3d565b60048303611789576040517f738281980000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063738281989061175890859085906004016151f0565b5f6040518083038186803b15801561176e575f5ffd5b505af4158015611780573d5f5f3e3d5ffd5b50505050505050565b600583036117e3576040517f066cfad10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063066cfad19061175890859085906004016151f0565b600f830361183d576040517fb1fe6fd10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063b1fe6fd19061175890859085906004016151f0565b600b830361191c577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166118a8576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f1fe8554200000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631fe855429061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b600c83036119fb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611987576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f704c288a0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063704c288a9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60348303611a53576040517e15460000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090621546009061175890859085906004016151f0565b60248303611acf576040517fa4dbb3b10000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063a4dbb3b19061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60258303611b4b576040517f09257a65000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906309257a659061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60268303611bc7576040517f1a8ba09b00000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090631a8ba09b9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60278303611c43576040517fcc08716e0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cc08716e9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60288303611cbf576040517f9baecc4800000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090639baecc489061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60228303611d3b576040517f3bba852300000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090633bba85239061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60238303611db7576040517fc58512f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063c58512f69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60298303611eb8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611e22576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f47af55b3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906347af55b39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b602a8303611fdb577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611f23576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fcea3f4ff0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063cea3f4ff9061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602d83036120fe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612046576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f84acbbb3000000000000000000000000000000000000000000000000000000008152730000000000000000000000000000000000000000906384acbbb39061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f000000000000000000000000000000000000000000000000000000000000000090600401615263565b602f830361217a576040517fdce507bc0000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063dce507bc9061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601283036121f6576040517f852495f70000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063852495f79061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b601383036122d5577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612261576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7707d3b600000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637707d3b69061175890859085907f000000000000000000000000000000000000000000000000000000000000000090600401615203565b60148303612431577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316612340576040517f9c31e5d20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b7f00000000000000000000000000000000000000000000000000000000000000001561239b576040517f1ce431f30000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f7b232fa100000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090637b232fa19061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60308303612529577f0000000000000000000000000000000000000000000000000000000000000000612493576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517f8b08833000000000000000000000000000000000000000000000000000000000815273000000000000000000000000000000000000000090638b0883309061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b60328303612621577f000000000000000000000000000000000000000000000000000000000000000061258b576040517f68050cb20000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b6040517fef0607f60000000000000000000000000000000000000000000000000000000081527300000000000000000000000000000000000000009063ef0607f69061175890859085907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009060040161522f565b6040517fd76a1e9e0000000000000000000000000000000000000000000000000000000081526004810184905260240161087f565b5f815c611664565b5f5f61266a848461295a565b5c949350505050565b61267e82825f613c78565b5050565b61268f8383836001613c8a565b610b04576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b6126da815f61137d565b50565b5f477ff69c8b0788d342486b85a01097c929624800d7097630313e97f0d9035cccfc585c8082101561273b576040517f53dad58300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612745818361508d565b9250505090565b5f6127598484845f613c8a565b90505b9392505050565b5f6108107fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e2612656565b5f5f6127b97fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e28461265e565b91506127e57f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b68461265e565b9050915091565b5f6127fe6127fa8484611607565b5c90565b15159392505050565b61267e6128148383611607565b5f61137d565b6128437fc3d79b9b31475c6807f8729c18cfd49e51bb0af93da4f39cd18b717082ea63e26126d0565b610a8a7f43885507ecdc938217c033a788623c3639bbf9936fd72956f8aa6ed0831824b66126d0565b7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316836001600160a01b03161480156128b557506128b283613d05565b81115b156128f7576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b610b046001600160a01b0384168383612682565b612919848484846001613df3565b610a06576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b5f818360405160200161296f91815260200190565b604051602081830303815290604052805190602001205f1c61275c91906151b4565b5f61299e828401846152a0565b9050806060015180156129c757505f60408201515160018111156129c4576129c46153ae565b14155b156129fe576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612a18835f0151846020015160018660a00151613e79565b8451516060860151929450909250905f90612a4557612a40856020015186604001515f6144ef565b612a4f565b8460400151602001515b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811115612aab576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8560600151612abb5730612ade565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b604080515f80825260208201818152828401909352929350915b85811015612c8b575f86612b0d8360016151b4565b14612b185730612b1e565b8960a001515b9050306001600160a01b03821603612b5c57612b5c89612b3f8460016151b4565b81518110612b4f57612b4f614e1f565b6020026020010151614676565b5f6040518060c001604052808681526020018581526020015f81526020018b8581518110612b8c57612b8c614e1f565b60200260200101516001600160a01b03168152602001876001600160a01b031681526020018881525090505f5f612c068d5f01518681518110612bd157612bd1614e1f565b60200260200101518c8781518110612beb57612beb614e1f565b60200260200101518b878760405160200161098d9190614ebe565b915091505f8b8681518110612c1d57612c1d614e1f565b6020026020010151612c2f5782612c31565b815b90505f811315612c6d576040517f62f708cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c7681614e4c565b99503098505050505050806001019050612af8565b508760800151841015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810185905260440161087f565b50505050505050505050565b5f612cf3828401846153db565b90505f5f612d0f835f0151846020015160018660a00151613e79565b915091505f6001845f015151612d25919061508d565b9050306001600160a01b03168460a001516001600160a01b031603612d5357612d5383612b3f8360016151b4565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84604001511115612db1576040517f0590fb9f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8460600151612dc15730612de4565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508460600151612dfc57612dfc8560200151614676565b5f6040518060c00160405280875f0151815260200185815260200184815260200187602001516001600160a01b03168152602001836001600160a01b03168152602001876080015181525090505f5f612ea9885f01518681518110612e6357612e63614e1f565b6020026020010151878781518110612e7d57612e7d614e1f565b60200260200101518a60400151612e9390614e4c565b8b60a001518760405160200161098d9190614ebe565b915091505f868681518110612ec057612ec0614e1f565b6020026020010151612ed25782612ed4565b815b9050886040015181612ee590614e4c565b14612f1c576040517f4e969c5800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b5f612f36828401846152a0565b905080606001518015612f5f57505f6040820151516001811115612f5c57612f5c6153ae565b14155b15612f96576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f612faf835f015184602001515f8660a00151613e79565b915091505f835f01515190505f838281518110612fce57612fce614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b031603612ffe57612ffe81614676565b5f85606001516130205761301b866020015187604001515f6144ef565b61302a565b8560400151602001515b9050613086866020015187606001516130435730613066565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b885180515f9061307857613078614e1f565b602002602001015184611552565b5f805b84811015613483575f5f5f8a5f015184815181106130a9576130a9614e1f565b60200260200101516001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156130ec573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131109190615498565b50915091505f89858151811061312857613128614e1f565b602002602001015161313a578161313c565b825b90505f8b868151811061315157613151614e1f565b60200260200101516001600160a01b03166370a082318e5f0151888151811061317c5761317c614e1f565b60200260200101516040518263ffffffff1660e01b81526004016131af91906001600160a01b0391909116815260200190565b602060405180830381865afa1580156131ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ee91906150a0565b905081811015613256578c5180518790811061320c5761320c614e1f565b60200260200101516040517f6cda144000000000000000000000000000000000000000000000000000000000815260040161087f91906001600160a01b0391909116815260200190565b613260828261508d565b9450505050505f895f0151838151811061327c5761327c614e1f565b60200260200101516001600160a01b0316630ea099c1838b86815181106132a5576132a5614e1f565b60200260200101516040518363ffffffff1660e01b81526004016132dc9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa1580156132f7573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061331b91906150a0565b90505f8761332a8560016151b4565b101561335c578a5161333d8560016151b4565b8151811061334d5761334d614e1f565b60200260200101519050613434565b8a608001518210156133aa5760808b01516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810183905260440161087f565b5060a08a01516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528816906370a0823190602401602060405180830381865afa15801561340d573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061343191906150a0565b94505b6134758b5f0151858151811061344c5761344c614e1f565b60200260200101518a868151811061346657613466614e1f565b602002602001015184846146c1565b505050806001019050613089565b5060a08701516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908616906370a0823190602401602060405180830381865afa1580156134eb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061350f91906150a0565b613519919061508d565b90508760800151811015612cda5760808801516040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260048101919091526024810182905260440161087f565b5f613576828401846153db565b90505f5f613591835f015184602001515f8660a00151613e79565b915091505f835f01515190505f8382815181106135b0576135b0614e1f565b60200260200101519050306001600160a01b03168560a001516001600160a01b0316036135e0576135e081614676565b5f6135ec8360016151b4565b67ffffffffffffffff81111561360457613604614b52565b60405190808252806020026020018201604052801561362d578160200160208202803683370190505b509050856040015181848151811061364757613647614e1f565b6020908102919091010152825b801561376d5761366381614e0a565b9050865f0151818151811061367a5761367a614e1f565b60200260200101516001600160a01b031663b95d88f88383600161369e91906151b4565b815181106136ae576136ae614e1f565b6020026020010151888460016136c491906151b4565b815181106136d4576136d4614e1f565b60200260200101516040518363ffffffff1660e01b815260040161370b9291909182526001600160a01b0316602082015260400190565b602060405180830381865afa158015613726573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061374a91906150a0565b82828151811061375c5761375c614e1f565b602002602001018181525050613654565b508560800151815f8151811061378557613785614e1f565b602002602001015111156137c5576040517f24df576f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f86606001516137d557306137f8565b7f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c5b90508660600151613810576138108760200151614676565b613855876020015182895f01515f8151811061382e5761382e614e1f565b6020026020010151855f8151811061384857613848614e1f565b6020026020010151611552565b5f805b85811015613998575f8661386d8360016151b4565b101561389f5789516138808360016151b4565b8151811061389057613890614e1f565b60200260200101519050613929565b5060a08901516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301528716906370a0823190602401602060405180830381865afa158015613902573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061392691906150a0565b92505b61398f8a5f0151838151811061394157613941614e1f565b602002602001015189848151811061395b5761395b614e1f565b60200260200101518785600161397191906151b4565b8151811061398157613981614e1f565b6020026020010151846146c1565b50600101613858565b5060a08801516040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201525f918391908716906370a0823190602401602060405180830381865afa158015613a00573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a2491906150a0565b613a2e919061508d565b90508860400151811015612f1c578860400151816040517f4e86d23a00000000000000000000000000000000000000000000000000000000815260040161087f929190918252602082015260400190565b5f80613a8d8385018561552f565b6040517f3593564c00000000000000000000000000000000000000000000000000000000815291935091503090633593564c90613ad390859085905f199060040161500f565b5f604051808303815f87803b158015613aea575f5ffd5b505af1925050508015613afb575060015b610a06573d808015613b28576040519150601f19603f3d011682016040523d82523d5f602084013e613b2d565b606091505b50613b378161475f565b50610a06565b5f8080613b4c8486018661560d565b919450925090505f6001600160a01b038416613b91576001600160a01b0383163014613b8257826001600160a01b031631613b8a565b613b8a6126dd565b9050613c33565b6001600160a01b0383163014613c27576040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528516906370a0823190602401602060405180830381865afa158015613bfe573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613c2291906150a0565b613c30565b613c3084613d05565b90505b81811015610d5e576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b815f52826020528060405f205d505050565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038616600452602485905291602083604481808b5af1925060015f51148316613cf9578383151615613ced573d5f823e3d81fd5b5f873b113d1516831692505b60405250949350505050565b5f7fb2ca7a901cefcdff410afa33ec3b5c33e20de4d02effd82fe5770654341094b25c6001600160a01b0316826001600160a01b031603613d74577fe23e4e5845226730941e1e4258083a3a47e7427a5c7a40aad225e39397ed55615c613d6a6126dd565b61166491906150f6565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015613dcf573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061166491906150a0565b6040517f23b872dd000000000000000000000000000000000000000000000000000000005f8181526001600160a01b038781166004528616602452604485905291602083606481808c5af1925060015f51148316613e68578383151615613e5c573d5f823e3d81fd5b5f883b113d1516831692505b604052505f60605295945050505050565b6060806001600160a01b038316613ebc576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85515f819003613ef8576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613f038160016151b4565b67ffffffffffffffff811115613f1b57613f1b614b52565b604051908082528060200260200182016040528015613f44578160200160208202803683370190505b5092508067ffffffffffffffff811115613f6057613f60614b52565b604051908082528060200260200182016040528015613f89578160200160208202803683370190505b50915085835f81518110613f9f57613f9f614e1f565b60200260200101906001600160a01b031690816001600160a01b0316815250505f5b818110156144e4575f888281518110613fdc57613fdc614e1f565b60209081029190910101516040517fe3152b4c0000000000000000000000000000000000000000000000000000000081526001600160a01b0380831660048301529192505f917f0000000000000000000000000000000000000000000000000000000000000000169063e3152b4c90602401602060405180830381865afa158015614069573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061408d919061512e565b90506001600160a01b0381166140da576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b6040517f5b16ebb70000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152821690635b16ebb790602401602060405180830381865afa158015614137573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061415b919061564b565b61419c576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260240161087f565b5f826001600160a01b031663648da8596040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141d9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141fd91906150a0565b9050881561426e577f434c0000000000000000000000000000000000000000000000000000000000008114614269576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b614300565b7f56325f564f4c4154494c4500000000000000000000000000000000000000000081141580156142be57507f56325f535441424c4500000000000000000000000000000000000000000000008114155b15614300576040517f3d325c6c0000000000000000000000000000000000000000000000000000000081526001600160a01b038416600482015260240161087f565b5f5f846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561433e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190614362919061512e565b856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561439e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906143c2919061512e565b915091505f826001600160a01b03168a88815181106143e3576143e3614e1f565b60200260200101516001600160a01b0316149050801580156144305750816001600160a01b03168a888151811061441c5761441c614e1f565b60200260200101516001600160a01b031614155b15614467576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8089888151811061447a5761447a614e1f565b91151560209283029190910190910152806144955782614497565b815b8a6144a38960016151b4565b815181106144b3576144b3614e1f565b60200260200101906001600160a01b031690816001600160a01b031681525050505050505050806001019050613fc1565b505094509492505050565b5f8115614665575f8351600181111561450a5761450a6153ae565b14614541576040517f0be470a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038616906370a0823190602401602060405180830381865afa15801561459e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145c291906150a0565b90506145d2858560200151614767565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038716906370a0823190602401602060405180830381865afa15801561462f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061465391906150a0565b61465d919061508d565b91505061275c565b61466f84846147a6565b905061275c845b6126da7fb40ce63e017bec58eb523d0fbbee064570ca416bf8fe65b36cedb27892fd77357f09fc40a0842bbcea52c0fee6f4e151fb9f6f5c95bf3ecbd2f0bae4887e688ac7836147ba565b5f5f846146cf57835f6146d2565b5f845b6040517f022c0d9f00000000000000000000000000000000000000000000000000000000815260048101839052602481018290526001600160a01b038681166044830152608060648301525f60848301529294509092509087169063022c0d9f9060a4015f604051808303815f87803b15801561474d575f5ffd5b505af1158015612cda573d5f5f3e3d5ffd5b805160208201fd5b61477082614676565b61267e6001600160a01b0383167f855a70dbf99265a74b6dcab9a86cb0a5802e4f52c100f0b91aa97e9ad19fad0d5c308461290b565b5f61275c836147b485613d05565b846147e8565b5f8181526020839052604090205c156147d257505050565b6147de82826001613c78565b610b04838261166a565b5f80825160018111156147fd576147fd6153ae565b0361485657828260200151111561484b576040517f897f6c580000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015260240161087f565b50602081015161275c565b620f42408260200151111561489f5781602001516040517f966987d500000000000000000000000000000000000000000000000000000000815260040161087f91815260200190565b612759838360200151620f42405f5f5f6148b9868661495c565b91509150815f036148dd578381816148d3576148d36150c9565b049250505061275c565b8184116148f4576148f46003851502601118614978565b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010185841190960395909502919093039390930492909217029150509392505050565b5f805f1983850993909202808410938190039390930393915050565b634e487b715f52806020526024601cfd5b6001600160a01b03811681146126da575f5ffd5b80356149a881614989565b919050565b5f5f83601f8401126149bd575f5ffd5b50813567ffffffffffffffff8111156149d4575f5ffd5b6020830191508360208285010111156149eb575f5ffd5b9250929050565b5f5f5f5f5f60808688031215614a06575f5ffd5b8535614a1181614989565b94506020860135614a2181614989565b935060408601359250606086013567ffffffffffffffff811115614a43575f5ffd5b614a4f888289016149ad565b969995985093965092949392505050565b5f5f5f5f5f60608688031215614a74575f5ffd5b853567ffffffffffffffff811115614a8a575f5ffd5b614a96888289016149ad565b909650945050602086013567ffffffffffffffff811115614ab5575f5ffd5b8601601f81018813614ac5575f5ffd5b803567ffffffffffffffff811115614adb575f5ffd5b8860208260051b8401011115614aef575f5ffd5b959894975060200195604001359392505050565b5f5f5f5f60608587031215614b16575f5ffd5b8435935060208501359250604085013567ffffffffffffffff811115614b3a575f5ffd5b614b46878288016149ad565b95989497509550505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160c0810167ffffffffffffffff81118282101715614ba257614ba2614b52565b60405290565b6040805190810167ffffffffffffffff81118282101715614ba257614ba2614b52565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bf457614bf4614b52565b604052919050565b5f67ffffffffffffffff821115614c1557614c15614b52565b5060051b60200190565b5f82601f830112614c2e575f5ffd5b8135614c41614c3c82614bfc565b614bcb565b8082825260208201915060208360051b860101925085831115614c62575f5ffd5b602085015b83811015614c88578035614c7a81614989565b835260209283019201614c67565b5095945050505050565b80151581146126da575f5ffd5b80356149a881614c92565b5f82601f830112614cb9575f5ffd5b8135614cc7614c3c82614bfc565b8082825260208201915060208360051b860101925085831115614ce8575f5ffd5b602085015b83811015614c88578035614d0081614c92565b835260209283019201614ced565b5f60208284031215614d1e575f5ffd5b813567ffffffffffffffff811115614d34575f5ffd5b820160c08185031215614d45575f5ffd5b614d4d614b7f565b813567ffffffffffffffff811115614d63575f5ffd5b614d6f86828501614c1f565b825250602082013567ffffffffffffffff811115614d8b575f5ffd5b614d9786828501614caa565b60208301525060408281013590820152614db36060830161499d565b6060820152614dc46080830161499d565b608082015260a091820135918101919091529392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f81614e1857614e18614ddd565b505f190190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f7f80000000000000000000000000000000000000000000000000000000000000008203614e7c57614e7c614ddd565b505f0390565b5f8151808452602084019350602083015f5b82811015614eb45781511515865260209586019590910190600101614e94565b5093949350505050565b6020808252825160c083830152805160e084018190525f92919091019082906101008501905b80831015614f10576001600160a01b038451168252602082019150602084019350600183019250614ee4565b5060208601519250601f19858203016040860152614f2e8184614e82565b92505050604084015160608401526060840151614f5660808501826001600160a01b03169052565b5060808401516001600160a01b03811660a08501525060a084015160c08401528091505092915050565b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614fb3575f5ffd5b83018035915067ffffffffffffffff821115614fcd575f5ffd5b6020019150368190038213156149eb575f5ffd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b606081525f6150216060830186614fe1565b828103602084015280855180835260208301915060208160051b840101602088015f5b8381101561507657601f19868403018552615060838351614fe1565b6020958601959093509190910190600101615044565b505080945050505050826040830152949350505050565b8181038181111561166457611664614ddd565b5f602082840312156150b0575f5ffd5b5051919050565b602081525f61275c6020830184614fe1565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f82615129577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b5f6020828403121561513e575f5ffd5b815161275c81614989565b6001600160a01b038616815284151560208201528360408201526001600160a01b038316606082015260a060808201525f61518760a0830184614fe1565b979650505050505050565b5f5f604083850312156151a3575f5ffd5b505080516020909101519092909150565b8082018082111561166457611664614ddd565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b602081525f6127596020830184866151c7565b604081525f6152166040830185876151c7565b90506001600160a01b0383166020830152949350505050565b606081525f6152426060830186886151c7565b6001600160a01b039485166020840152929093166040909101529392505050565b608081525f6152766080830187896151c7565b6001600160a01b039586166020840152938516604083015250921660609092019190915292915050565b5f602082840312156152b0575f5ffd5b813567ffffffffffffffff8111156152c6575f5ffd5b820180840360e08112156152d8575f5ffd5b6152e0614b7f565b823567ffffffffffffffff8111156152f6575f5ffd5b61530287828601614c1f565b825250602083013561531381614989565b602082015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc083011215615347575f5ffd5b61534f614ba8565b9150604083013560028110615362575f5ffd5b8252606083013560208301526040810182905261538160808401614c9f565b606082015260a08301356080820181905291506153a060c0840161499d565b60a082015295945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f602082840312156153eb575f5ffd5b813567ffffffffffffffff811115615401575f5ffd5b820160c08185031215615412575f5ffd5b61541a614b7f565b813567ffffffffffffffff811115615430575f5ffd5b61543c86828501614c1f565b825250602082013561544d81614989565b602082015260408281013590820152606082013561546a81614c92565b60608201526080828101359082015260a0909101359061548982614989565b60a08101919091529392505050565b5f5f5f606084860312156154aa575f5ffd5b5050815160208301516040909301519094929350919050565b5f82601f8301126154d2575f5ffd5b813567ffffffffffffffff8111156154ec576154ec614b52565b6154ff6020601f19601f84011601614bcb565b818152846020838601011115615513575f5ffd5b816020850160208301375f918101602001919091529392505050565b5f5f60408385031215615540575f5ffd5b823567ffffffffffffffff811115615556575f5ffd5b615562858286016154c3565b925050602083013567ffffffffffffffff81111561557e575f5ffd5b8301601f8101851361558e575f5ffd5b803561559c614c3c82614bfc565b8082825260208201915060208360051b8501019250878311156155bd575f5ffd5b602084015b838110156155fe57803567ffffffffffffffff8111156155e0575f5ffd5b6155ef8a6020838901016154c3565b845250602092830192016155c2565b50809450505050509250929050565b5f5f5f6060848603121561561f575f5ffd5b833561562a81614989565b9250602084013561563a81614989565b929592945050506040919091013590565b5f6020828403121561565b575f5ffd5b815161275c81614c9256fea26469706673582212200b9b76d18116ba4fbcf799f853e027611cf243b1ac3e7152fe22d5efe86925cc64736f6c63430008240033","sourceMap":"2499:46257:41:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9764:10;-1:-1:-1;;;;;9786:4:41;9764:27;;;;;:87;;-1:-1:-1;1398:47:51;4769:12:42;9795:56:41;9764:87;9760:133;;;9868:18;;;;;;;;;;;;;;9760:133;2499:46257;;;;;4056:37;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;194:55:76;;;176:74;;164:2;149:18;4056:37:41;;;;;;;;11436:1187;;;;;;;;;;-1:-1:-1;11436:1187:41;;;;;:::i;:::-;;:::i;:::-;;;1896:66:76;1884:79;;;1866:98;;1854:2;1839:18;11436:1187:41;1722:248:76;4292:43:41;;;;;;;;;;;;;;;;;;2121:25:76;;;2109:2;2094:18;4292:43:41;1975:177:76;3672:38:41;;;;;;;;;;;;;;;4222:36;;;;;;;;;;;;;;;3977:45;;;;;;;;;;;;;;;12735:741;;;;;;:::i;:::-;;:::i;3744:52::-;;;;;;;;;;;;;;;3600:38;;;;;;;;;;;;;;;3539:27;;;;;;;;;;;;;;;3914:29;;;;;;;;;;;;;;;;;;4377:14:76;;4370:22;4352:41;;4340:2;4325:18;3914:29:41;4212:187:76;15165:123:41;;;;;;;;;;-1:-1:-1;1398:47:51;4769:12:42;15165:123:41;;4127:61;;;;;;;;;;;;;;;3830:50;;;;;;;;;;;;;;;13510:1621;;;;;;;;;;-1:-1:-1;13510:1621:41;;;;;:::i;:::-;;:::i;11436:1187::-;11566:16;1398:47:51;4769:12:42;11649:1:41;11594:56;11590:85;;11659:16;;;;;;;;;;;;;;11590:85;5515:53:51;4769:12:42;5901:49:51;4769:12:42;6162:50:51;4769:12:42;-1:-1:-1;;;;;11989:29:41;;11985:63;;12027:21;;;;;;;;;;;;;;11985:63;12058:10;-1:-1:-1;;;;;12058:33:41;;;12054:64;;12100:18;;;;;;;;;;;;;;12054:64;12137:15;-1:-1:-1;;;;;12128:24:41;:5;-1:-1:-1;;;;;12128:24:41;;12124:58;;12161:21;;;;;;;;;;;;;;12124:58;12204:16;12192:8;:28;12188:62;;12229:21;;;;;;;;;;;;;;12188:62;12478:34;:32;:34::i;:::-;12518:46;12543:10;12555:8;12518:24;:46::i;:::-;-1:-1:-1;12577:41:41;;11436:1187;-1:-1:-1;;;;;;;;11436:1187:41:o;12735:741::-;12854:24;:22;:24::i;:::-;12888:34;;;12884:63;;12931:16;;;;;;;;;;;;;;12884:63;12975:9;12957:15;:27;12953:49;;;12993:9;;;;;;;;;;;;;;12953:49;1398:47:51;4769:12:42;13013:56:41;13009:285;;13177:10;13199:4;13177:27;13173:56;;13213:16;;;;;;;;;;;;;;13173:56;13237:36;13254:9;;13265:7;;13237:16;:36::i;:::-;13281:7;;13009:285;13300:17;:15;:17::i;:::-;1398:47:51;4769:12:42;13374:36:41;13391:9;;13402:7;;13374:16;:36::i;:::-;13416:22;13430:7;13416:13;:22::i;:::-;13449;;-1:-1:-1;;;;;13449:22:41;;;;;;;;12848:628;12735:741;;;;;;:::o;15256:27::-;15249:34;;15165:123;:::o;13510:1621::-;13630:24;:22;:24::i;:::-;3057:46:51;4769:12:42;-1:-1:-1;;;;;13899:29:41;;:10;:29;13895:75;;13937:33;;;;;13959:10;13937:33;;;176:74:76;149:18;;13937:33:41;;;;;;;;13895:75;13976:73;3057:46:51;14047:1:41;13976:23;:73::i;:::-;14122:21;14146:17;;;;14193;;14220:36;;;14216:72;;14265:23;;;;;;;;;;;;;;14216:72;14295:20;14326:16;:48;;14361:13;14326:48;;;14345:13;14326:48;14295:80;-1:-1:-1;14381:35:41;14419:39;;;;14430:5;14419:39;:::i;:::-;14570:19;;;;14381:77;;-1:-1:-1;14570:23:41;14566:337;;14603:12;14620:9;:19;;14618:21;;;;;:::i;:::-;;;;;;14603:36;;14750:132;14767:9;:15;;;14783:4;14767:21;;;;;;;;:::i;:::-;;;;;;;14790:9;:20;;;14811:4;14790:26;;;;;;;;:::i;:::-;;;;;;;14826:12;14818:21;;;:::i;:::-;14841:10;14864:9;14853:21;;;;;;;;:::i;:::-;;;;;;;;;;;;;14750:7;:132::i;:::-;;;14890:7;;;;;;;;14566:337;14998:9;:21;;;14983:12;:36;14979:67;;;15028:18;;;;;;;;;;;;;;14979:67;15052:74;15065:9;:17;;;15084:9;:15;;;15101:10;15113:12;15052;:74::i;:::-;13624:1507;;;;;13510:1621;;;;;:::o;10312:222:51:-;10355:56;5515:53;10409:1;10355:23;:56::i;:::-;10417:52;5901:49;10467:1;10417:23;:52::i;:::-;10475:54;6162:50;10527:1;10475:23;:54::i;:::-;10312:222::o;6891:366::-;6963:17;6983:35;6996:11;7009:8;6983:12;:35::i;:::-;6963:55;-1:-1:-1;4769:12:42;;7028:38:51;7024:51;;7068:7;6891:366;;:::o;7024:51::-;7080:37;7104:9;7115:1;7080:23;:37::i;:::-;7123:62;3861:51;7173:11;7123:22;:62::i;:::-;7191:61;4188:48;7243:8;7191:26;:61::i;:::-;6957:300;6891:366;;:::o;46739:132:41:-;46813:4;-1:-1:-1;;;;;46822:15:41;46805:32;;46801:65;;46846:20;;;;;;;;;;;;;;15513:734;15632:9;15614:15;15654:589;15676:7;15671:2;:12;15654:589;;;15700:20;15722:17;15743:22;15751:9;;15761:2;15751:13;;;;;;;:::i;:::-;;;;;;;;;48379:26;48358:48;;;5742:4:46;48358:48:41;;48443:26;48428:41;;;:46;;;48219:260;15743:22;15699:66;;;;15778:12;15773:464;;15802:36;15812:12;15826:7;;15834:2;15826:11;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;15802:9;:36::i;:::-;15773:464;;;15893:45;;13431:66:76;15910:27:41;;;;13419:79:76;15893:45:41;;;13407:92:76;15863:27:41;;13515:11:76;;15893:45:41;;;;;;-1:-1:-1;;15893:45:41;;;15990:1;15978:14;;;;;;;;;15893:45;-1:-1:-1;15948:27:41;;15893:45;15978:14;;;;;;;;;;;;;;;;;;;;15948:44;;16020:7;;16028:2;16020:11;;;;;;;:::i;:::-;;;;;;;;;;;;:::i;:::-;16002:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16002:15:41;;:12;;-1:-1:-1;16002:29:41;;-1:-1:-1;16002:15:41;;;-1:-1:-1;16002:15:41;;;;:::i;:::-;;;;;;;;;;:29;16156:61;;;;;:4;;:12;;:61;;16169:14;;16185:12;;-1:-1:-1;;16199:17:41;16156:61;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;16152:77;15853:384;;15773:464;-1:-1:-1;;15685:4:41;;15654:589;;;;15608:639;15513:734;;;;:::o;16437:730::-;16487:82;1398:47:51;16556:10:41;16487:23;:82::i;:::-;16575:102;1647:54:51;16643:33:41;16667:9;16643:21;:33;:::i;:::-;16575:23;:102::i;:::-;16928:12;-1:-1:-1;;;;;16920:35:41;;16916:247;;16965:99;2190:52:51;17048:12:41;-1:-1:-1;;;;;17024:39:41;16965:23;:99::i;:::-;17072:84;2808:57:51;17137:18:41;17072:23;:84::i;19079:4402::-;19145:15;19163:58;3533:48:51;19163:24:41;:58::i;:::-;19145:76;;19232:10;19227:598;19249:7;19244:2;:12;19227:598;;;19272:14;19289:58;3533:48:51;19344:2:41;19289:20;:58::i;:::-;19272:75;;19355:63;3295:50:51;19411:6:41;19355:25;:63::i;:::-;19654:12;-1:-1:-1;;;;;19636:31:41;:6;-1:-1:-1;;;;;19636:31:41;;19632:45;;19669:8;;;19632:45;19704:39;;;;;19737:4;19704:39;;;176:74:76;19685:16:41;;-1:-1:-1;;;;;19704:24:41;;;;;149:18:76;;19704:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;19685:58;-1:-1:-1;19755:12:41;;19751:67;;19769:49;-1:-1:-1;;;;;19769:27:41;;19797:10;19809:8;19769:27;:49::i;:::-;19264:561;;19227:598;19258:4;;19227:598;;;;19830:57;3533:48:51;19830:23:41;:57::i;:::-;19894:21;19918:40;:38;:40::i;:::-;19894:64;-1:-1:-1;20017:20:41;20047:17;;20043:957;;20075:13;20090:18;20120:10;-1:-1:-1;;;;;20112:24:41;20144:13;20112:50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;20074:88;;;;20175:8;20170:824;;20658:12;-1:-1:-1;;;;;20650:35:41;20646:75;;20715:5;20694:27;;;;;;;;;;;:::i;20646:75::-;20731:21;20755:34;20771:18;20755:13;:34;:::i;:::-;20731:58;;20819:1;20803:13;:17;:77;;;;-1:-1:-1;20825:55:41;-1:-1:-1;;;;;20825:12:41;:28;20854:10;20866:13;20825:28;:55::i;:::-;20824:56;20803:77;20799:140;;;20922:5;20901:27;;;;;;;;;;;:::i;20799:140::-;20963:22;20984:1;20963:18;:22;:::i;:::-;20948:37;;20185:809;20170:824;20066:934;;20043:957;21422:12;21379:40;:38;:40::i;:::-;:55;21375:93;;;21443:25;;;;;;;;;;;;;;21375:93;21802:18;21823:34;:32;:34::i;:::-;21802:55;;21868:10;21863:1438;21885:10;21880:2;:15;21863:1438;;;21912:19;21933:16;21953:32;21982:2;21953:28;:32::i;:::-;21911:74;;;;22204:53;22235:11;22248:8;22204:30;:53::i;:::-;22199:68;;22259:8;;;;22199:68;22279:38;;;;;;;;2121:25:76;;;-1:-1:-1;;;;;22279:28:41;;;;;2094:18:76;;22279:38:41;;;;;;;;;;;;;;;;;;-1:-1:-1;22279:38:41;;;;;;;;-1:-1:-1;;22279:38:41;;;;;;;;;;;;:::i;:::-;;;22275:623;;;22565:4;-1:-1:-1;;;;;22540:30:41;;;22536:58;;22579:15;;;;;;;;;;;;;;22536:58;22318:285;22275:623;23245:49;23272:11;23285:8;23245:26;:49::i;:::-;21903:1398;;21863:1438;21897:4;;21863:1438;;;;23306:32;:30;:32::i;:::-;23345:70;1647:54:51;23413:1:41;23345:23;:70::i;:::-;23421:55;1398:47:51;23474:1:41;638:109:42;730:6;723:5;716:21;638:109;;:::o;42355:1127:41:-;42512:15;;3057:46:51;4769:12:42;-1:-1:-1;;;;;42764:22:41;;;42760:63;;42795:28;;;;;-1:-1:-1;;;;;194:55:76;;42795:28:41;;;176:74:76;149:18;;42795:28:41;14:242:76;42760:63:41;42829:95;3057:46:51;42916:5:41;-1:-1:-1;;;;;42900:23:41;42829;:95::i;:::-;43051:21;43075:11;:66;;3267:65;43075:66;;;3107:13;43075:66;43195:84;;;;;43051:90;;-1:-1:-1;;;;;;43195:19:41;;;;;:84;;43215:10;;43227:11;;43240:16;;43051:90;;43273:5;;43195:84;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;43172:107;;-1:-1:-1;43172:107:41;-1:-1:-1;3057:46:51;4769:12:42;43369:74:41;43365:112;;43452:25;;;;;-1:-1:-1;;;;;194:55:76;;43452:25:41;;;176:74:76;149:18;;43452:25:41;14:242:76;43365:112:41;42546:936;;42355:1127;;;;;;;;:::o;2941:500:48:-;3060:4;-1:-1:-1;;;;;3042:23:48;;;3038:91;;3075:33;3080:6;3088:10;3100:7;3075:4;:33::i;:::-;3116:7;;3038:91;-1:-1:-1;;;;;3220:20:48;;;;:61;;-1:-1:-1;1398:47:51;4769:12:42;-1:-1:-1;;;;;3244:37:48;:6;-1:-1:-1;;;;;3244:37:48;;;3220:61;3216:100;;;3290:26;;;;;;;;;;;;;;3216:100;3376:60;-1:-1:-1;;;;;3376:31:48;;3408:6;3416:10;3428:7;3376:31;:60::i;19594:178:51:-;19715:51;;;-1:-1:-1;;;;;17630:55:76;;19715:51:51;;;17612:74:76;17702:18;;;17695:34;;;4489:42:51;17745:18:76;;;17738:34;19677:13:51;;17585:18:76;;19715:51:51;;;;;;;;;;;;19705:62;;;;;;19698:69;;19594:178;;;;;:::o;1855:246:42:-;1920:15;1938:18;1945:10;1938:6;:18::i;:::-;1920:36;;1962:13;1978:33;1991:10;2003:7;1978:12;:33::i;:::-;1962:49;;2048:6;2041:5;2034:21;2066:30;2072:10;2084:11;:7;2094:1;2084:11;:::i;23925:4692:41:-;24135:12;24131:4482;;24186:22;24201:6;;24186:14;:22::i;24131:4482::-;1752:4:46;24225:12:41;:42;24221:4392;;24277:23;24293:6;;24277:15;:23::i;24221:4392::-;1908:4:46;24317:12:41;:41;24313:4300;;24368:22;24383:6;;24368:14;:22::i;24313:4300::-;2067:4:46;24407:12:41;:42;24403:4210;;24459:23;24475:6;;24459:15;:23::i;24403:4210::-;4996:4:46;24523:12:41;:41;24519:4094;;24574:23;24590:6;;24574:15;:23::i;24519:4094::-;5216:4:46;24614:12:41;:38;24610:4003;;24662:21;24676:6;;24662:13;:21::i;24610:4003::-;393:4:46;24720:12:41;:30;24716:3897;;24760:25;;;;;:11;;:17;;:25;;24778:6;;;;24760:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6957:300:51;6891:366;;:::o;24716:3897:41:-;577:4:46;24802:12:41;:33;24798:3815;;24845:28;;;;;:11;;:20;;:28;;24866:6;;;;24845:28;;;:::i;24798:3815::-;1156:4:46;24890:12:41;:35;24886:3727;;24935:29;;;;;:11;;:21;;:29;;24957:6;;;;24935:29;;;:::i;24886:3727::-;749:4:46;24981:12:41;:33;24977:3636;;25036:4;-1:-1:-1;;;;;25028:27:41;25024:69;;25064:29;;;;;;;;2121:25:76;;;2094:18;;25064:29:41;1975:177:76;25024:69:41;25101:33;;;;;:11;;:19;;:33;;25121:6;;;;25129:4;;25101:33;;;:::i;24977:3636::-;956:4:46;25151:12:41;:36;25147:3466;;25209:4;-1:-1:-1;;;;;25201:27:41;25197:69;;25237:29;;;;;;;;2121:25:76;;;2094:18;;25237:29:41;1975:177:76;25197:69:41;25274:36;;;;;:11;;:22;;:36;;25297:6;;;;25305:4;;25274:36;;;:::i;25147:3466::-;1425:4:46;25327:12:41;:37;25323:3290;;25374:31;;;;;:11;;:23;;:31;;25398:6;;;;25374:31;;;:::i;25323:3290::-;2572:4:46;25446:12:41;:41;25442:3171;;25497:54;;;;;:13;;:28;;:54;;25526:6;;;;25534:16;;25497:54;;;:::i;25442:3171::-;2735:4:46;25568:12:41;:46;25564:3049;;25624:59;;;;;:13;;:33;;:59;;25658:6;;;;25666:16;;25624:59;;;:::i;25564:3049::-;2903:4:46;25700:12:41;:46;25696:2917;;25756:59;;;;;:13;;:33;;:59;;25790:6;;;;25798:16;;25756:59;;;:::i;25696:2917::-;3060:4:46;25832:12:41;:40;25828:2785;;25882:53;;;;;:13;;:27;;:53;;25910:6;;;;25918:16;;25882:53;;;:::i;25828:2785::-;3262:4:46;25952:12:41;:41;25948:2665;;26003:54;;;;;:13;;:28;;:54;;26032:6;;;;26040:16;;26003:54;;;:::i;25948:2665::-;2239:4:46;26098:12:41;:38;26094:2519;;26146:51;;;;;:12;;:25;;:51;;26172:6;;;;26180:16;;26146:51;;;:::i;26094:2519::-;2405:4:46;26214:12:41;:41;26210:2403;;26265:54;;;;;:12;;:28;;:54;;26294:6;;;;26302:16;;26265:54;;;:::i;26210:2403::-;3437:4:46;26355:12:41;:36;26351:2262;;26413:10;-1:-1:-1;;;;;26405:33:41;26401:75;;26447:29;;;;;;;;2121:25:76;;;2094:18;;26447:29:41;1975:177:76;26401:75:41;26484:59;;;;;:10;;:21;;:59;;26506:6;;;;26514:10;;26526:16;;26484:59;;;:::i;26351:2262::-;3590:4:46;26560:12:41;:38;26556:2057;;26620:10;-1:-1:-1;;;;;26612:33:41;26608:75;;26654:29;;;;;;;;2121:25:76;;;2094:18;;26654:29:41;1975:177:76;26608:75:41;26691:77;;;;;:10;;:23;;:77;;26715:6;;;;26723:10;;26735:14;;26751:16;;26691:77;;;:::i;26556:2057::-;3767:4:46;26803:12:41;:44;26799:1814;;26869:10;-1:-1:-1;;;;;26861:33:41;26857:75;;26903:29;;;;;;;;2121:25:76;;;2094:18;;26903:29:41;1975:177:76;26857:75:41;26940:81;;;;;:9;;:27;;:81;;26968:6;;;;26976:10;;26988:14;;27004:16;;26940:81;;;:::i;26799:1814::-;3944:4:46;27038:12:41;:43;27034:1579;;27091:51;;;;;:9;;:25;;:51;;27117:6;;;;27125:16;;27091:51;;;:::i;27034:1579::-;4464:4:46;27182:12:41;:37;27178:1435;;27229:45;;;;;:13;;:25;;:45;;27255:6;;;;27263:10;;27229:45;;;:::i;27178:1435::-;4636:4:46;27291:12:41;:44;27287:1326;;27357:10;-1:-1:-1;;;;;27349:33:41;27345:75;;27391:29;;;;;;;;2121:25:76;;;2094:18;;27391:29:41;1975:177:76;27345:75:41;27428:51;;;;;:13;;:31;;:51;;27460:6;;;;27468:10;;27428:51;;;:::i;27287:1326::-;4812:4:46;27715:12:41;:31;27711:902;;27768:10;-1:-1:-1;;;;;27760:33:41;27756:75;;27802:29;;;;;;;;2121:25:76;;;2094:18;;27802:29:41;1975:177:76;27756:75:41;27843:7;27839:41;;;27859:21;;;;;;;;2121:25:76;;;2094:18;;27859:21:41;1975:177:76;27839:41:41;27888:56;;;;;:13;;:20;;:56;;27909:6;;;;27917:10;;27929:14;;27888:56;;;:::i;27711:902::-;4116:4:46;28196:12:41;:37;28192:421;;28248:7;28243:42;;28264:21;;;;;;;;2121:25:76;;;2094:18;;28264:21:41;1975:177:76;28243:42:41;28293:64;;;;;:13;;:25;;:64;;28319:6;;;;28327:14;;28343:13;;28293:64;;;:::i;28192:421::-;4274:4:46;28374:12:41;:38;28370:243;;28427:7;28422:42;;28443:21;;;;;;;;2121:25:76;;;2094:18;;28443:21:41;1975:177:76;28422:42:41;28472:74;;;;;:13;;:26;;:74;;28499:6;;;;28507:14;;28523:22;;28472:74;;;:::i;28370:243::-;28574:32;;;;;;;;2121:25:76;;;2094:18;;28574:32:41;1975:177:76;3555:110:42;3614:15;4769:12;;3644:16;4668:123;3892:196;3963:14;3985:13;4001:32;4014:10;4026:6;4001:12;:32::i;:::-;4066:12;;3892:196;-1:-1:-1;;;;3892:196:42:o;3263:104::-;3329:33;3342:10;3354:4;3360:1;3329:12;:33::i;:::-;3263:104;;:::o;1219:204:67:-;1306:37;1320:5;1327:2;1331:5;1338:4;1306:13;:37::i;:::-;1301:116;;1366:40;;;;;-1:-1:-1;;;;;194:55:76;;1366:40:67;;;176:74:76;149:18;;1366:40:67;14:242:76;2883:75:42;2933:20;2939:10;2951:1;2933:5;:20::i;:::-;2883:75;:::o;16408:365:51:-;16465:16;16514:21;1647:54;4769:12:42;16632:37:51;;;16628:90;;;16678:40;;;;;;;;;;;;;;16628:90;16731:37;16748:20;16731:14;:37;:::i;:::-;16724:44;;;;16408:365;:::o;2031:152:67:-;2115:4;2138:38;2152:5;2159:2;2163:5;2170;2138:13;:38::i;:::-;2131:45;;2031:152;;;;;;:::o;15327:137:51:-;15378:15;15408:51;3861;15408:24;:51::i;15666:254::-;15727:19;15748:16;15786:55;3861:51;15834:6;15786:20;:55::i;:::-;15772:69;;15858:57;4188:48;15908:6;15858:24;:57::i;:::-;15847:68;;15666:254;;;:::o;15008:185::-;15094:15;15124:59;15147:35;15160:11;15173:8;15147:12;:35::i;:::-;4769:12:42;;4668:123;15124:59:51;:64;;;15008:185;-1:-1:-1;;;15008:185:51:o;7556:142::-;7630:63;7654:35;7667:11;7680:8;7654:12;:35::i;:::-;7691:1;7630:23;:63::i;7792:150::-;7833:50;3861:51;7833:23;:50::i;:::-;7889:48;4188;7889:23;:48::i;1454:305:48:-;2190:52:51;4769:12:42;-1:-1:-1;;;;;1540:39:48;:6;-1:-1:-1;;;;;1540:39:48;;:98;;;;;1593:45;1631:6;1593:37;:45::i;:::-;1583:7;:55;1540:98;1536:165;;;1655:39;;;;;-1:-1:-1;;;;;194:55:76;;1655:39:48;;;176:74:76;149:18;;1655:39:48;14:242:76;1536:165:48;1706:48;-1:-1:-1;;;;;1706:27:48;;1734:10;1746:7;1706:27;:48::i;1662:232:67:-;1767:47;1785:5;1792:4;1798:2;1802:5;1809:4;1767:17;:47::i;:::-;1762:126;;1837:40;;;;;-1:-1:-1;;;;;194:55:76;;1837:40:67;;;176:74:76;149:18;;1837:40:67;14:242:76;5557:173:42;5637:13;5718:6;5702:10;5691:22;;;;;;2121:25:76;;2109:2;2094:18;;1975:177;5691:22:42;;;;;;;;;;;;;5681:33;;;;;;5673:42;;:51;;;;:::i;29160:2675:41:-;29222:32;29257:39;;;;29268:6;29257:39;:::i;:::-;29222:74;;29400:7;:19;;;:64;;;;-1:-1:-1;29448:16:41;29423;;;;:21;:41;;;;;;;;:::i;:::-;;;29400:64;29396:95;;;29473:18;;;;;;;;;;;;;;29396:95;29499:24;29525:25;29560:78;29582:7;:13;;;29597:7;:15;;;29614:4;29620:7;:17;;;29560:21;:78::i;:::-;29662:13;;:20;29796:19;;;;29498:140;;-1:-1:-1;29498:140:41;;-1:-1:-1;29662:20:41;29644:15;;29796:102;;29843:55;29857:7;:15;;;29874:7;:16;;;29892:5;29843:13;:55::i;:::-;29796:102;;;29818:7;:16;;;:22;;;29796:102;29770:128;;30035:16;30015:9;:37;30011:66;;;30061:16;;;;;;;;;;;;;;30011:66;30083:14;30100:7;:19;;;:65;;30160:4;30100:65;;;1398:47:51;4769:12:42;30122:27:41;30320:16;;;30289:28;30320:16;;;;;;30375:13;;;;;;;;;30083:82;;-1:-1:-1;30320:16:41;30427:1240;30449:7;30444:2;:12;30427:1240;;;30564:18;30595:7;30585:6;:2;30590:1;30585:6;:::i;:::-;:17;:53;;30633:4;30585:53;;;30605:7;:17;;;30585:53;30564:74;-1:-1:-1;30672:4:41;-1:-1:-1;;;;;30650:27:41;;;30646:76;;30679:43;30706:7;30714:6;:2;30719:1;30714:6;:::i;:::-;30706:15;;;;;;;;:::i;:::-;;;;;;;30679:26;:43::i;:::-;30814:35;30852:201;;;;;;;;30888:11;30852:201;;;;30921:16;30852:201;;;;30958:1;30852:201;;;;30978:7;30986:2;30978:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;30852:201:41;;;;;31006:6;-1:-1:-1;;;;;30852:201:41;;;;;31035:9;30852:201;;;30814:239;;31062:15;31079;31106:97;31114:7;:13;;;31128:2;31114:17;;;;;;;;:::i;:::-;;;;;;;31133:11;31145:2;31133:15;;;;;;;;:::i;:::-;;;;;;;31157:9;31169:10;31192:9;31181:21;;;;;;;;:::i;31106:97::-;31061:142;;;;31311:19;31333:11;31345:2;31333:15;;;;;;;;:::i;:::-;;;;;;;:37;;31362:8;31333:37;;;31351:8;31333:37;31311:59;;31397:1;31382:12;:16;31378:48;;;31407:19;;;;;;;;;;;;;;31378:48;31558:13;31559:12;31558:13;:::i;:::-;31538:34;;31655:4;31638:22;;30464:1203;;;;;30458:4;;;;;30427:1240;;;;31751:7;:20;;;31739:9;:32;31735:95;;;31798:20;;;;31780:50;;;;;;;;24551:25:76;;;;24592:18;;;24585:34;;;24524:18;;31780:50:41;24377:248:76;31735:95:41;29216:2619;;;;;;;;29160:2675;;:::o;32411:1826::-;32474:33;32510:40;;;;32521:6;32510:40;:::i;:::-;32474:76;;32558:24;32584:25;32619:78;32641:7;:13;;;32656:7;:15;;;32673:4;32679:7;:17;;;32619:21;:78::i;:::-;32557:140;;;;32703:18;32747:1;32724:7;:13;;;:20;:24;;;;:::i;:::-;32703:45;;32861:4;-1:-1:-1;;;;;32832:34:41;:7;:17;;;-1:-1:-1;;;;;32832:34:41;;32828:91;;32868:51;32895:7;32903:14;:10;32916:1;32903:14;:::i;32868:51::-;33038:16;33010:7;:17;;;:45;33006:74;;;33064:16;;;;;;;;;;;;;;33006:74;33190:14;33207:7;:19;;;:65;;33267:4;33207:65;;;1398:47:51;4769:12:42;33229:27:41;33190:82;;33374:7;:19;;;33369:69;;33395:43;33422:7;:15;;;33395:26;:43::i;:::-;33537:35;33575:207;;;;;;;;33609:7;:13;;;33575:207;;;;33642:11;33575:207;;;;33672:10;33575:207;;;;33699:7;:15;;;-1:-1:-1;;;;;33575:207:41;;;;;33729:6;-1:-1:-1;;;;;33575:207:41;;;;;33756:7;:19;;;33575:207;;;33537:245;;33789:15;33806;33825:165;33840:7;:13;;;33854:10;33840:25;;;;;;;;:::i;:::-;;;;;;;33873:11;33885:10;33873:23;;;;;;;;:::i;:::-;;;;;;;33912:7;:17;;;33904:26;;;:::i;:::-;33938:7;:17;;;33974:9;33963:21;;;;;;;;:::i;33825:165::-;33788:202;;;;34085:19;34107:11;34119:10;34107:23;;;;;;;;:::i;:::-;;;;;;;:45;;34144:8;34107:45;;;34133:8;34107:45;34085:67;;34188:7;:17;;;34171:12;34170:13;;;:::i;:::-;34162:43;34158:74;;34214:18;;;;;;;;;;;;;;34158:74;32468:1769;;;;;;;;;32411:1826;;:::o;34956:2859::-;35018:32;35053:39;;;;35064:6;35053:39;:::i;:::-;35018:74;;35196:7;:19;;;:64;;;;-1:-1:-1;35244:16:41;35219;;;;:21;:41;;;;;;;;:::i;:::-;;;35196:64;35192:95;;;35269:18;;;;;;;;;;;;;;35192:95;35295:24;35321:25;35356:79;35378:7;:13;;;35393:7;:15;;;35410:5;35417:7;:17;;;35356:21;:79::i;:::-;35294:141;;;;35515:15;35533:7;:13;;;:20;35515:38;;35559:17;35579:7;35587;35579:16;;;;;;;;:::i;:::-;;;;;;;35559:36;;35634:4;-1:-1:-1;;;;;35605:34:41;:7;:17;;;-1:-1:-1;;;;;35605:34:41;;35601:77;;35641:37;35668:9;35641:26;:37::i;:::-;35766:17;35792:7;:19;;;:102;;35839:55;35853:7;:15;;;35870:7;:16;;;35888:5;35839:13;:55::i;:::-;35792:102;;;35814:7;:16;;;:22;;;35792:102;35766:128;;35900:137;35920:7;:15;;;35937:7;:19;;;:65;;35997:4;35937:65;;;1398:47:51;4769:12:42;35959:27:41;36004:13;;:16;;:13;;:16;;;;:::i;:::-;;;;;;;36022:9;35900:12;:137::i;:::-;36044:22;;36109:1449;36131:7;36126:2;:12;36109:1449;;;36154:23;36305:17;36324;36352:7;:13;;;36366:2;36352:17;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;36346:36:41;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;36304:80;;;;;36394:18;36415:11;36427:2;36415:15;;;;;;;;:::i;:::-;;;;;;;:39;;36445:9;36415:39;;;36433:9;36415:39;36394:60;;36464:20;36494:7;36502:2;36494:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;36487:29:41;;36517:7;:13;;;36531:2;36517:17;;;;;;;;:::i;:::-;;;;;;;36487:48;;;;;;;;;;;;;;-1:-1:-1;;;;;194:55:76;;;;176:74;;164:2;149:18;;14:242;36487:48:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;36464:71;;36564:10;36549:12;:25;36545:72;;;36599:13;;:17;;36613:2;;36599:17;;;;;;:::i;:::-;;;;;;;36583:34;;;;;;;;;;-1:-1:-1;;;;;194:55:76;;;;176:74;;164:2;149:18;;14:242;36545:72:41;36645:25;36660:10;36645:12;:25;:::i;:::-;36627:43;;36185:494;;;;36805:18;36832:7;:13;;;36846:2;36832:17;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;36826:49:41;;36876:15;36893:7;36901:2;36893:11;;;;;;;;:::i;:::-;;;;;;;36826:79;;;;;;;;;;;;;;;26510:25:76;;;-1:-1:-1;;;;;26571:55:76;26566:2;26551:18;;26544:83;26498:2;26483:18;;26336:297;36826:79:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;36805:100;-1:-1:-1;36913:18:41;36952:7;36943:6;:2;36948:1;36943:6;:::i;:::-;:16;36939:538;;;36984:13;;36998:6;:2;37003:1;36998:6;:::i;:::-;36984:21;;;;;;;;:::i;:::-;;;;;;;36971:34;;36939:538;;;37167:7;:20;;;37154:10;:33;37150:97;;;37214:20;;;;37196:51;;;;;;;;24551:25:76;;;;24592:18;;;24585:34;;;24524:18;;37196:51:41;24377:248:76;37150:97:41;-1:-1:-1;37270:17:41;;;;37429:39;;;;;-1:-1:-1;;;;;194:55:76;;;37429:39:41;;;176:74:76;37429:27:41;;;;;149:18:76;;37429:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;37412:56;;36939:538;37484:67;37492:7;:13;;;37506:2;37492:17;;;;;;;;:::i;:::-;;;;;;;37511:11;37523:2;37511:15;;;;;;;;:::i;:::-;;;;;;;37528:10;37540;37484:7;:67::i;:::-;36146:1412;;;36140:4;;;;;36109:1449;;;-1:-1:-1;37674:17:41;;;;37646:46;;;;;-1:-1:-1;;;;;194:55:76;;;37646:46:41;;;176:74:76;37626:17:41;;37695:14;;37646:27;;;;;;149:18:76;;37646:46:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:63;;;;:::i;:::-;37626:83;;37731:7;:20;;;37719:9;:32;37715:95;;;37778:20;;;;37760:50;;;;;;;;24551:25:76;;;;24592:18;;;24585:34;;;24524:18;;37760:50:41;24377:248:76;38567:2437:41;38630:33;38666:40;;;;38677:6;38666:40;:::i;:::-;38630:76;;38714:24;38740:25;38775:79;38797:7;:13;;;38812:7;:15;;;38829:5;38836:7;:17;;;38775:21;:79::i;:::-;38713:141;;;;38860:15;38878:7;:13;;;:20;38860:38;;38904:17;38924:7;38932;38924:16;;;;;;;;:::i;:::-;;;;;;;38904:36;;39053:4;-1:-1:-1;;;;;39024:34:41;:7;:17;;;-1:-1:-1;;;;;39024:34:41;;39020:77;;39060:37;39087:9;39060:26;:37::i;:::-;39176:25;39218:11;:7;39228:1;39218:11;:::i;:::-;39204:26;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;39204:26:41;;39176:54;;39256:7;:17;;;39236:8;39245:7;39236:17;;;;;;;;:::i;:::-;;;;;;;;;;:37;39297:7;39279:257;39306:6;;39279:257;;39323:4;;;:::i;:::-;;;39452:7;:13;;;39466:2;39452:17;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;39446:48:41;;39495:8;39504:2;39509:1;39504:6;;;;:::i;:::-;39495:16;;;;;;;;:::i;:::-;;;;;;;39513:7;39521:2;39526:1;39521:6;;;;:::i;:::-;39513:15;;;;;;;;:::i;:::-;;;;;;;39446:83;;;;;;;;;;;;;;;26510:25:76;;;-1:-1:-1;;;;;26571:55:76;26566:2;26551:18;;26544:83;26498:2;26483:18;;26336:297;39446:83:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;39431:8;39440:2;39431:12;;;;;;;;:::i;:::-;;;;;;:98;;;;;39279:257;;;;39637:7;:19;;;39623:8;39632:1;39623:11;;;;;;;;:::i;:::-;;;;;;;:33;39619:64;;;39665:18;;;;;;;;;;;;;;39619:64;39758:14;39775:7;:19;;;:65;;39835:4;39775:65;;;1398:47:51;4769:12:42;39797:27:41;39758:82;;39942:7;:19;;;39937:69;;39963:43;39990:7;:15;;;39963:26;:43::i;:::-;40012:68;40025:7;:15;;;40042:6;40050:7;:13;;;40064:1;40050:16;;;;;;;;:::i;:::-;;;;;;;40068:8;40077:1;40068:11;;;;;;;;:::i;:::-;;;;;;;40012:12;:68::i;:::-;40087:22;;40152:587;40174:7;40169:2;:12;40152:587;;;40315:18;40354:7;40345:6;:2;40350:1;40345:6;:::i;:::-;:16;40341:311;;;40386:13;;40400:6;:2;40405:1;40400:6;:::i;:::-;40386:21;;;;;;;;:::i;:::-;;;;;;;40373:34;;40341:311;;;-1:-1:-1;40445:17:41;;;;40604:39;;;;;-1:-1:-1;;;;;194:55:76;;;40604:39:41;;;176:74:76;40604:27:41;;;;;149:18:76;;40604:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;40587:56;;40341:311;40659:73;40667:7;:13;;;40681:2;40667:17;;;;;;;;:::i;:::-;;;;;;;40686:11;40698:2;40686:15;;;;;;;;:::i;:::-;;;;;;;40703:8;40712:2;40717:1;40712:6;;;;:::i;:::-;40703:16;;;;;;;;:::i;:::-;;;;;;;40721:10;40659:7;:73::i;:::-;-1:-1:-1;40183:4:41;;40152:587;;;-1:-1:-1;40869:17:41;;;;40841:46;;;;;-1:-1:-1;;;;;194:55:76;;;40841:46:41;;;176:74:76;40821:17:41;;40890:14;;40841:27;;;;;;149:18:76;;40841:46:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:63;;;;:::i;:::-;40821:83;;40926:7;:17;;;40914:9;:29;40910:89;;;40970:7;:17;;;40989:9;40952:47;;;;;;;;;;;24551:25:76;;;24607:2;24592:18;;24585:34;24539:2;24524:18;;24377:248;43725:303:41;43797:25;;43853:36;;;;43864:6;43853:36;:::i;:::-;43899:57;;;;;43796:93;;-1:-1:-1;43796:93:41;-1:-1:-1;43899:4:41;;:12;;:57;;43796:93;;;;-1:-1:-1;;43938:17:41;43899:57;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;43895:129;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;44001:16;44009:7;44001;:16::i;:::-;43964:60;43895:129;;47382:558;47457:14;;;47512:47;;;;47523:6;47512:47;:::i;:::-;47456:103;;-1:-1:-1;47456:103:41;-1:-1:-1;47456:103:41;-1:-1:-1;47565:16:41;-1:-1:-1;;;;;47591:20:41;;47587:281;;-1:-1:-1;;;;;47632:23:41;;47650:4;47632:23;:83;;47701:6;-1:-1:-1;;;;;47701:14:41;;47632:83;;;47658:40;:38;:40::i;:::-;47621:94;;47587:281;;;-1:-1:-1;;;;;47755:23:41;;47773:4;47755:23;:106;;47829:32;;;;;-1:-1:-1;;;;;194:55:76;;;47829:32:41;;;176:74:76;47829:24:41;;;;;149:18:76;;47829:32:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;47755:106;;;47781:45;47819:6;47781:37;:45::i;:::-;47736:125;;47587:281;47888:11;47877:8;:22;47873:62;;;47908:27;;;;;-1:-1:-1;;;;;194:55:76;;47908:27:41;;;176:74:76;149:18;;47908:27:41;14:242:76;1021:207:42;1138:4;1132;1125:18;1163:10;1157:4;1150:24;1211:6;1204:4;1198;1188:21;1181:37;1021:207;;;:::o;8373:1244:67:-;8600:4;8594:11;8509:24;8467:12;8618:22;;;-1:-1:-1;;;;;8666:24:67;;8660:4;8653:38;8711:4;8704:19;;;8467:12;8787:4;8467:12;8775:4;8467:12;;8759:5;8752;8747:45;8736:56;;9004:1;8997:4;8991:11;8988:18;8979:7;8975:32;8965:606;;9136:6;9126:7;9119:15;9115:28;9112:165;;;9192:16;9186:4;9181:3;9166:43;9242:16;9237:3;9230:29;9112:165;9553:1;9545:5;9533:18;9530:25;9511:16;9504:24;9500:56;9491:7;9487:70;9476:81;;8965:606;9591:4;9584:17;-1:-1:-1;8373:1244:67;;-1:-1:-1;;;;8373:1244:67:o;17481:236:51:-;17551:16;2190:52;4769:12:42;-1:-1:-1;;;;;17579:23:51;:6;-1:-1:-1;;;;;17579:23:51;;17575:81;;2808:57;4769:12:42;17611:24:51;:22;:24::i;:::-;:45;;;;:::i;17575:81::-;17673:39;;;;;17706:4;17673:39;;;176:74:76;-1:-1:-1;;;;;17673:24:51;;;;;149:18:76;;17673:39:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;10165:1393:67:-;10460:4;10454:11;10365:28;10323:12;10478:22;;;-1:-1:-1;;;;;10526:26:67;;;10520:4;10513:40;10579:24;;10573:4;10566:38;10624:4;10617:19;;;10323:12;10700:4;10323:12;10688:4;10323:12;;10672:5;10665;10660:45;10649:56;;10917:1;10910:4;10904:11;10901:18;10892:7;10888:32;10878:606;;11049:6;11039:7;11032:15;11028:28;11025:165;;;11105:16;11099:4;11094:3;11079:43;11155:16;11150:3;11143:29;11025:165;11466:1;11458:5;11446:18;11443:25;11424:16;11417:24;11413:56;11404:7;11400:70;11389:81;;10878:606;11504:4;11497:17;-1:-1:-1;11540:1:67;11534:4;11527:15;10165:1393;;-1:-1:-1;;;;;10165:1393:67:o;44575:1748:41:-;44727:24;;-1:-1:-1;;;;;44790:24:41;;44786:55;;44823:18;;;;;;;;;;;;;;44786:55;44865:13;;44847:15;44888:12;;;44884:38;;44909:13;;;;;;;;;;;;;;44884:38;44952:11;:7;44962:1;44952:11;:::i;:::-;44938:26;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;44938:26:41;;44928:36;;44995:7;44984:19;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;44984:19:41;;44970:33;;45022:8;45009:7;45017:1;45009:10;;;;;;;;:::i;:::-;;;;;;:21;-1:-1:-1;;;;;45009:21:41;;;-1:-1:-1;;;;;45009:21:41;;;;;45042:10;45037:1282;45059:7;45054:2;:12;45037:1282;;;45082:13;45098:6;45105:2;45098:10;;;;;;;;:::i;:::-;;;;;;;;;;;45252:39;;;;;-1:-1:-1;;;;;194:55:76;;;45252:39:41;;;176:74:76;45098:10:41;;-1:-1:-1;45233:16:41;;45252;:32;;;;149:18:76;;45252:39:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45233:58;-1:-1:-1;;;;;;45303:22:41;;45299:53;;45334:18;;;;;-1:-1:-1;;;;;194:55:76;;45334:18:41;;;176:74:76;149:18;;45334::41;14:242:76;45299:53:41;45365:36;;;;;-1:-1:-1;;;;;194:55:76;;;45365:36:41;;;176:74:76;45365:29:41;;;;;149:18:76;;45365:36:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45360:68;;45410:18;;;;;-1:-1:-1;;;;;194:55:76;;45410:18:41;;;176:74:76;149:18;;45410::41;14:242:76;45360:68:41;45532:17;45558:5;-1:-1:-1;;;;;45552:22:41;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45532:44;;45641:8;45637:218;;;45678:13;45665:9;:26;45661:57;;45700:18;;;;;-1:-1:-1;;;;;194:55:76;;45700:18:41;;;176:74:76;149:18;;45700::41;14:242:76;45661:57:41;45637:218;;;45750:22;45737:9;:35;;:72;;;;;45789:20;45776:9;:33;;45737:72;45733:122;;;45828:18;;;;;-1:-1:-1;;;;;194:55:76;;45828:18:41;;;176:74:76;149:18;;45828::41;14:242:76;45733:122:41;45929:15;45946;45972:5;-1:-1:-1;;;;;45966:19:41;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45995:5;-1:-1:-1;;;;;45989:19:41;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;45928:83;;;;46019:18;46055:7;-1:-1:-1;;;;;46040:22:41;:7;46048:2;46040:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;46040:22:41;;46019:43;;46075:13;46074:14;:40;;;;;46107:7;-1:-1:-1;;;;;46092:22:41;:7;46100:2;46092:11;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;;;;46092:22:41;;;46074:40;46070:66;;;46123:13;;;;;;;;;;;;;;46070:66;46162:13;46144:11;46156:2;46144:15;;;;;;;;:::i;:::-;:31;;;:15;;;;;;;;;;;:31;46279:13;:33;;46305:7;46279:33;;;46295:7;46279:33;46261:7;46269:6;:2;46274:1;46269:6;:::i;:::-;46261:15;;;;;;;;:::i;:::-;;;;;;:51;-1:-1:-1;;;;;46261:51:41;;;-1:-1:-1;;;;;46261:51:41;;;;;45074:1245;;;;;;45068:4;;;;;45037:1282;;;;44780:1543;44575:1748;;;;;;;:::o;4295:550:48:-;4418:15;4445:12;4441:400;;;4486:28;4471:11;;:43;;;;;;;;:::i;:::-;;4467:86;;4523:30;;;;;;;;;;;;;;4467:86;4586:39;;;;;4619:4;4586:39;;;176:74:76;4561:22:48;;-1:-1:-1;;;;;4586:24:48;;;;;149:18:76;;4586:39:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4561:64;;4633:26;4638:6;4646;:12;;;4633:4;:26::i;:::-;4677:39;;;;;4710:4;4677:39;;;176:74:76;4719:14:48;;-1:-1:-1;;;;;4677:24:48;;;;;149:18:76;;4677:39:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:56;;;;:::i;:::-;4667:66;;4459:281;4441:400;;;4764:28;4777:6;4785;4764:12;:28::i;:::-;4754:38;;4800:34;4827:6;6389:119:51;6440:63;3533:48;3295:50;6496:6;6440:23;:63::i;41365:285:41:-;41471:19;41492;41515:11;:65;;41557:10;41577:1;41515:65;;;41538:1;41542:10;41515:65;41586:59;;;;;;;;29765:25:76;;;29806:18;;;29799:34;;;-1:-1:-1;;;;;29869:55:76;;;29849:18;;;29842:83;29961:3;29941:18;;;29934:31;-1:-1:-1;29981:19:76;;;29974:30;41470:110:41;;-1:-1:-1;41470:110:41;;-1:-1:-1;41586:17:41;;;;;;30021:19:76;;41586:59:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;48611:143;48735:7;48729:14;48722:4;48713:7;48709:18;48702:42;2188:245:48;2250:34;2277:6;2250:26;:34::i;:::-;2344:84;-1:-1:-1;;;;;2344:31:48;;1398:47:51;4769:12:42;2413:4:48;2420:7;2344:31;:84::i;5350:225::-;5463:15;5493:77;5508:6;5516:45;5554:6;5516:37;:45::i;:::-;5563:6;5493:14;:77::i;1481:202:42:-;5140:14;5179:18;;;5211:4;5204:24;;;5267:4;5251:21;;5245:28;1569:34;1565:47;;1481:202;;;:::o;1565:47::-;1617:33;1630:10;1642:4;1648:1;1617:12;:33::i;:::-;1656:22;1661:10;1673:4;1656;:22::i;5891:600:48:-;6028:15;;6055:11;;:43;;;;;;;;:::i;:::-;;6051:184;;6127:8;6112:6;:12;;;:23;6108:94;;;6154:39;;;;;-1:-1:-1;;;;;194:55:76;;6154:39:48;;;176:74:76;149:18;;6154:39:48;14:242:76;6108:94:48;-1:-1:-1;6216:12:48;;;;6209:19;;6051:184;171:9:40;6359:6:48;:12;;;:23;6355:73;;;6415:6;:12;;;6391:37;;;;;;;;;2121:25:76;;2109:2;2094:18;;1975:177;6355:73:48;6441:45;6453:8;6463:6;:12;;;171:9:40;7378:14:74;7429:12;7443:11;7458:12;7465:1;7468;7458:6;:12::i;:::-;7428:42;;;;7552:4;7560:1;7552:9;7548:365;;7887:11;7881:3;:17;;;;;:::i;:::-;;7874:24;;;;;;7548:365;8038:4;8023:11;:19;8019:142;;8062:84;5328:5;8082:16;;5327:36;940:4:72;5322:42:74;8062:11;:84::i;:::-;8413:17;8564:11;8561:1;8558;8551:25;8956:12;8986:15;;;8971:31;;9121:22;;;;;9854:1;9835;:15;;9834:21;;10087;;;10083:25;;10072:36;10157:21;;;10153:25;;10142:36;10229:21;;;10225:25;;10214:36;10300:21;;;10296:25;;10285:36;10373:21;;;10369:25;;10358:36;10447:21;;;10443:25;;;10432:36;9363:12;;;;9359:23;;;9384:1;9355:31;8676:18;;;8666:29;;;9470:11;;;;8719:19;;;;9214:14;;;;9463:18;;;;10922:13;;-1:-1:-1;;7296:3683:74;;;;;:::o;1027:550::-;1088:12;;-1:-1:-1;;1471:1:74;1468;1461:20;1501:9;;;;1549:11;;;1535:12;;;;1531:30;;;;;1027:550;-1:-1:-1;;1027:550:74:o;1776:194:72:-;1881:10;1875:4;1868:24;1918:4;1912;1905:18;1949:4;1943;1936:18;261:154:76;-1:-1:-1;;;;;340:5:76;336:54;329:5;326:65;316:93;;405:1;402;395:12;420:134;488:20;;517:31;488:20;517:31;:::i;:::-;420:134;;;:::o;559:347::-;610:8;620:6;674:3;667:4;659:6;655:17;651:27;641:55;;692:1;689;682:12;641:55;-1:-1:-1;715:20:76;;758:18;747:30;;744:50;;;790:1;787;780:12;744:50;827:4;819:6;815:17;803:29;;879:3;872:4;863:6;855;851:19;847:30;844:39;841:59;;;896:1;893;886:12;841:59;559:347;;;;;:::o;911:806::-;1008:6;1016;1024;1032;1040;1093:3;1081:9;1072:7;1068:23;1064:33;1061:53;;;1110:1;1107;1100:12;1061:53;1149:9;1136:23;1168:31;1193:5;1168:31;:::i;:::-;1218:5;-1:-1:-1;1275:2:76;1260:18;;1247:32;1288:33;1247:32;1288:33;:::i;:::-;1340:7;-1:-1:-1;1420:2:76;1405:18;;1392:32;;-1:-1:-1;1501:2:76;1486:18;;1473:32;1528:18;1517:30;;1514:50;;;1560:1;1557;1550:12;1514:50;1599:58;1649:7;1640:6;1629:9;1625:22;1599:58;:::i;:::-;911:806;;;;-1:-1:-1;911:806:76;;-1:-1:-1;1676:8:76;;1573:84;911:806;-1:-1:-1;;;911:806:76:o;2410:1038::-;2536:6;2544;2552;2560;2568;2621:2;2609:9;2600:7;2596:23;2592:32;2589:52;;;2637:1;2634;2627:12;2589:52;2677:9;2664:23;2710:18;2702:6;2699:30;2696:50;;;2742:1;2739;2732:12;2696:50;2781:58;2831:7;2822:6;2811:9;2807:22;2781:58;:::i;:::-;2858:8;;-1:-1:-1;2755:84:76;-1:-1:-1;;2946:2:76;2931:18;;2918:32;2975:18;2962:32;;2959:52;;;3007:1;3004;2997:12;2959:52;3030:24;;3085:4;3077:13;;3073:27;-1:-1:-1;3063:55:76;;3114:1;3111;3104:12;3063:55;3154:2;3141:16;3180:18;3172:6;3169:30;3166:50;;;3212:1;3209;3202:12;3166:50;3265:7;3260:2;3250:6;3247:1;3243:14;3239:2;3235:23;3231:32;3228:45;3225:65;;;3286:1;3283;3276:12;3225:65;2410:1038;;;;-1:-1:-1;3317:2:76;3309:11;;3414:2;3399:18;3386:32;;2410:1038;-1:-1:-1;;;2410:1038:76:o;5284:641::-;5370:6;5378;5386;5394;5447:2;5435:9;5426:7;5422:23;5418:32;5415:52;;;5463:1;5460;5453:12;5415:52;5508:23;;;-1:-1:-1;5628:2:76;5613:18;;5600:32;;-1:-1:-1;5709:2:76;5694:18;;5681:32;5736:18;5725:30;;5722:50;;;5768:1;5765;5758:12;5722:50;5807:58;5857:7;5848:6;5837:9;5833:22;5807:58;:::i;:::-;5284:641;;;;-1:-1:-1;5884:8:76;-1:-1:-1;;;;5284:641:76:o;5930:184::-;5982:77;5979:1;5972:88;6079:4;6076:1;6069:15;6103:4;6100:1;6093:15;6119:253;6191:2;6185:9;6233:4;6221:17;;6268:18;6253:34;;6289:22;;;6250:62;6247:88;;;6315:18;;:::i;:::-;6351:2;6344:22;6119:253;:::o;6377:251::-;6449:2;6443:9;;;6479:15;;6524:18;6509:34;;6545:22;;;6506:62;6503:88;;;6571:18;;:::i;6633:334::-;6704:2;6698:9;6760:2;6750:13;;-1:-1:-1;;6746:86:76;6734:99;;6863:18;6848:34;;6884:22;;;6845:62;6842:88;;;6910:18;;:::i;:::-;6946:2;6939:22;6633:334;;-1:-1:-1;6633:334:76:o;6972:183::-;7032:4;7065:18;7057:6;7054:30;7051:56;;;7087:18;;:::i;:::-;-1:-1:-1;7132:1:76;7128:14;7144:4;7124:25;;6972:183::o;7160:744::-;7214:5;7267:3;7260:4;7252:6;7248:17;7244:27;7234:55;;7285:1;7282;7275:12;7234:55;7325:6;7312:20;7352:64;7368:47;7408:6;7368:47;:::i;:::-;7352:64;:::i;:::-;7440:3;7464:6;7459:3;7452:19;7496:4;7491:3;7487:14;7480:21;;7557:4;7547:6;7544:1;7540:14;7532:6;7528:27;7524:38;7510:52;;7585:3;7577:6;7574:15;7571:35;;;7602:1;7599;7592:12;7571:35;7638:4;7630:6;7626:17;7652:221;7668:6;7663:3;7660:15;7652:221;;;7750:3;7737:17;7767:31;7792:5;7767:31;:::i;:::-;7811:18;;7858:4;7849:14;;;;7685;7652:221;;;-1:-1:-1;7891:7:76;7160:744;-1:-1:-1;;;;;7160:744:76:o;7909:118::-;7995:5;7988:13;7981:21;7974:5;7971:32;7961:60;;8017:1;8014;8007:12;8032:128;8097:20;;8126:28;8097:20;8126:28;:::i;8165:738::-;8216:5;8269:3;8262:4;8254:6;8250:17;8246:27;8236:55;;8287:1;8284;8277:12;8236:55;8327:6;8314:20;8354:64;8370:47;8410:6;8370:47;:::i;8354:64::-;8442:3;8466:6;8461:3;8454:19;8498:4;8493:3;8489:14;8482:21;;8559:4;8549:6;8546:1;8542:14;8534:6;8530:27;8526:38;8512:52;;8587:3;8579:6;8576:15;8573:35;;;8604:1;8601;8594:12;8573:35;8640:4;8632:6;8628:17;8654:218;8670:6;8665:3;8662:15;8654:218;;;8752:3;8739:17;8769:28;8791:5;8769:28;:::i;:::-;8810:18;;8857:4;8848:14;;;;8687;8654:218;;8908:1175;9003:6;9056:2;9044:9;9035:7;9031:23;9027:32;9024:52;;;9072:1;9069;9062:12;9024:52;9112:9;9099:23;9145:18;9137:6;9134:30;9131:50;;;9177:1;9174;9167:12;9131:50;9200:22;;9256:4;9238:16;;;9234:27;9231:47;;;9274:1;9271;9264:12;9231:47;9300:22;;:::i;:::-;9360:2;9347:16;9388:18;9378:8;9375:32;9372:52;;;9420:1;9417;9410:12;9372:52;9447:56;9495:7;9484:8;9480:2;9476:17;9447:56;:::i;:::-;9440:5;9433:71;;9550:2;9546;9542:11;9529:25;9579:18;9569:8;9566:32;9563:52;;;9611:1;9608;9601:12;9563:52;9647:53;9692:7;9681:8;9677:2;9673:17;9647:53;:::i;:::-;9642:2;9631:14;;9624:77;-1:-1:-1;9767:2:76;9759:11;;;9746:25;9787:14;;;9780:31;9843;9870:2;9862:11;;9843:31;:::i;:::-;9838:2;9831:5;9827:14;9820:55;9908:32;9935:3;9931:2;9927:12;9908:32;:::i;:::-;9902:3;9891:15;;9884:57;10007:3;9999:12;;;9986:26;10028:15;;;10021:32;;;;9895:5;8908:1175;-1:-1:-1;;;8908:1175:76:o;10088:184::-;10140:77;10137:1;10130:88;10237:4;10234:1;10227:15;10261:4;10258:1;10251:15;10277:196;10316:3;10344:5;10334:39;;10353:18;;:::i;:::-;-1:-1:-1;;;10389:78:76;;10277:196::o;10478:184::-;10530:77;10527:1;10520:88;10627:4;10624:1;10617:15;10651:4;10648:1;10641:15;10667:191;10702:3;10733:66;10726:5;10723:77;10720:103;;10803:18;;:::i;:::-;-1:-1:-1;10843:1:76;10839:13;;10667:191::o;10863:433::-;10913:3;10951:5;10945:12;10978:6;10973:3;10966:19;11010:4;11005:3;11001:14;10994:21;;11049:4;11042:5;11038:16;11072:1;11082:189;11096:6;11093:1;11090:13;11082:189;;;11171:13;;11164:21;11157:29;11145:42;;11216:4;11207:14;;;;11244:17;;;;11118:1;11111:9;11082:189;;;-1:-1:-1;11287:3:76;;10863:433;-1:-1:-1;;;;10863:433:76:o;11301:1389::-;11502:2;11484:21;;;11576:13;;11625:4;11605:18;;;11598:32;11679:19;;11543:3;11528:19;;11707:22;;;11465:4;;11787:21;;;;;11465:4;;11760:3;11745:19;;;11836:218;11850:6;11847:1;11844:13;11836:218;;;-1:-1:-1;;;;;11921:6:76;11915:13;11911:62;11906:3;11899:75;12003:2;11998:3;11994:12;11987:19;;12041:2;12033:6;12029:15;12019:25;;11872:1;11869;11865:9;11860:14;;11836:218;;;11840:3;12103:2;12095:6;12091:15;12085:22;12063:44;;-1:-1:-1;;12156:9:76;12151:3;12147:19;12143:92;12138:2;12127:9;12123:18;12116:120;12259:46;12301:3;12285:14;12259:46;:::i;:::-;12245:60;;;;12359:2;12351:6;12347:15;12341:22;12336:2;12325:9;12321:18;12314:50;12413:2;12405:6;12401:15;12395:22;12426:55;12476:3;12465:9;12461:19;12445:14;-1:-1:-1;;;;;4470:54:76;4458:67;;4404:127;12426:55;-1:-1:-1;12530:3:76;12518:16;;12512:23;-1:-1:-1;;;;;4470:54:76;;12594:3;12579:19;;4458:67;12544:55;12655:3;12647:6;12643:16;12637:23;12630:4;12619:9;12615:20;12608:53;12678:6;12670:14;;;11301:1389;;;;:::o;12695:580::-;12772:4;12778:6;12838:11;12825:25;12928:66;12917:8;12901:14;12897:29;12893:102;12873:18;12869:127;12859:155;;13010:1;13007;13000:12;12859:155;13037:33;;13089:20;;;-1:-1:-1;13132:18:76;13121:30;;13118:50;;;13164:1;13161;13154:12;13118:50;13197:4;13185:17;;-1:-1:-1;13228:14:76;13224:27;;;13214:38;;13211:58;;;13265:1;13262;13255:12;13537:347;13578:3;13616:5;13610:12;13643:6;13638:3;13631:19;13699:6;13692:4;13685:5;13681:16;13674:4;13669:3;13665:14;13659:47;13751:1;13744:4;13735:6;13730:3;13726:16;13722:27;13715:38;13873:4;-1:-1:-1;;13798:2:76;13790:6;13786:15;13782:88;13777:3;13773:98;13769:109;13762:116;;;13537:347;;;;:::o;13889:1031::-;14160:2;14149:9;14142:21;14123:4;14186:44;14226:2;14215:9;14211:18;14203:6;14186:44;:::i;:::-;14278:9;14270:6;14266:22;14261:2;14250:9;14246:18;14239:50;14309:6;14344;14338:13;14375:6;14367;14360:22;14410:2;14402:6;14398:15;14391:22;;14469:2;14459:6;14456:1;14452:14;14444:6;14440:27;14436:36;14507:2;14499:6;14495:15;14528:1;14538:310;14552:6;14549:1;14546:13;14538:310;;;-1:-1:-1;;14629:6:76;14621;14617:19;14613:92;14608:3;14601:105;14729:39;14761:6;14752;14746:13;14729:39;:::i;:::-;14803:2;14826:12;;;;14719:49;;-1:-1:-1;14791:15:76;;;;;14574:1;14567:9;14538:310;;;14542:3;;14865:6;14857:14;;;;;;14907:6;14902:2;14891:9;14887:18;14880:34;13889:1031;;;;;;:::o;14925:128::-;14992:9;;;15013:11;;;15010:37;;;15027:18;;:::i;15058:230::-;15128:6;15181:2;15169:9;15160:7;15156:23;15152:32;15149:52;;;15197:1;15194;15187:12;15149:52;-1:-1:-1;15242:16:76;;15058:230;-1:-1:-1;15058:230:76:o;15503:217::-;15650:2;15639:9;15632:21;15613:4;15670:44;15710:2;15699:9;15695:18;15687:6;15670:44;:::i;15725:184::-;15777:77;15774:1;15767:88;15874:4;15871:1;15864:15;15898:4;15895:1;15888:15;15914:274;15954:1;15980;15970:189;;16015:77;16012:1;16005:88;16116:4;16113:1;16106:15;16144:4;16141:1;16134:15;15970:189;-1:-1:-1;16173:9:76;;15914:274::o;16193:251::-;16263:6;16316:2;16304:9;16295:7;16291:23;16287:32;16284:52;;;16332:1;16329;16322:12;16284:52;16364:9;16358:16;16383:31;16408:5;16383:31;:::i;16449:610::-;-1:-1:-1;;;;;16704:6:76;16700:55;16689:9;16682:74;16806:6;16799:14;16792:22;16787:2;16776:9;16772:18;16765:50;16851:6;16846:2;16835:9;16831:18;16824:34;-1:-1:-1;;;;;16898:6:76;16894:55;16889:2;16878:9;16874:18;16867:83;16987:3;16981;16970:9;16966:19;16959:32;16663:4;17008:45;17048:3;17037:9;17033:19;17025:6;17008:45;:::i;:::-;17000:53;16449:610;-1:-1:-1;;;;;;;16449:610:76:o;17064:341::-;17141:6;17149;17202:2;17190:9;17181:7;17177:23;17173:32;17170:52;;;17218:1;17215;17208:12;17170:52;-1:-1:-1;;17263:16:76;;17369:2;17354:18;;;17348:25;17263:16;;17348:25;;-1:-1:-1;17064:341:76:o;17783:125::-;17848:9;;;17869:10;;;17866:36;;;17882:18;;:::i;17913:325::-;18001:6;17996:3;17989:19;18053:6;18046:5;18039:4;18034:3;18030:14;18017:43;;18105:1;18098:4;18089:6;18084:3;18080:16;18076:27;18069:38;17971:3;18227:4;-1:-1:-1;;18152:2:76;18144:6;18140:15;18136:88;18131:3;18127:98;18123:109;18116:116;;17913:325;;;;:::o;18243:252::-;18408:2;18397:9;18390:21;18371:4;18428:61;18485:2;18474:9;18470:18;18462:6;18454;18428:61;:::i;18500:386::-;18707:2;18696:9;18689:21;18670:4;18727:61;18784:2;18773:9;18769:18;18761:6;18753;18727:61;:::i;:::-;18719:69;;-1:-1:-1;;;;;18828:6:76;18824:55;18819:2;18808:9;18804:18;18797:83;18500:386;;;;;;:::o;19293:536::-;19558:2;19547:9;19540:21;19521:4;19578:61;19635:2;19624:9;19620:18;19612:6;19604;19578:61;:::i;:::-;-1:-1:-1;;;;;19675:55:76;;;19670:2;19655:18;;19648:83;19767:55;;;;19762:2;19747:18;;;19740:83;19570:69;19293:536;-1:-1:-1;;;19293:536:76:o;19834:674::-;20143:3;20132:9;20125:22;20106:4;20164:62;20221:3;20210:9;20206:19;20198:6;20190;20164:62;:::i;:::-;-1:-1:-1;;;;;20262:55:76;;;20257:2;20242:18;;20235:83;20354:55;;;20349:2;20334:18;;20327:83;-1:-1:-1;20446:55:76;;20441:2;20426:18;;;20419:83;;;;20156:70;19834:674;-1:-1:-1;;19834:674:76:o;22721:1462::-;22815:6;22868:2;22856:9;22847:7;22843:23;22839:32;22836:52;;;22884:1;22881;22874:12;22836:52;22924:9;22911:23;22957:18;22949:6;22946:30;22943:50;;;22989:1;22986;22979:12;22943:50;23012:22;;23053:16;;;23089:4;23081:13;;23078:33;;;23107:1;23104;23097:12;23078:33;23133:22;;:::i;:::-;23193:2;23180:16;23221:18;23211:8;23208:32;23205:52;;;23253:1;23250;23243:12;23205:52;23280:56;23328:7;23317:8;23313:2;23309:17;23280:56;:::i;:::-;23273:5;23266:71;;23382:2;23378;23374:11;23361:25;23395:33;23420:7;23395:33;:::i;:::-;23455:2;23444:14;;23437:31;23561:2;23492:66;23484:75;;23480:84;23477:104;;;23577:1;23574;23567:12;23477:104;23605:22;;:::i;:::-;23590:37;;23672:2;23668;23664:11;23651:25;23707:1;23698:7;23695:14;23685:42;;23723:1;23720;23713:12;23685:42;23736:24;;23826:2;23818:11;;23805:25;23859:2;23846:16;;23839:33;23899:2;23888:14;;23881:31;;;23944:29;23968:3;23960:12;;23944:29;:::i;:::-;23939:2;23928:14;;23921:53;24040:3;24032:12;;24019:26;24072:3;24061:15;;24054:32;;;24019:26;-1:-1:-1;24119:33:76;24146:4;24138:13;;24119:33;:::i;:::-;24113:3;24102:15;;24095:58;24106:5;22721:1462;-1:-1:-1;;;;;22721:1462:76:o;24188:184::-;24240:77;24237:1;24230:88;24337:4;24334:1;24327:15;24361:4;24358:1;24351:15;24630:1240;24725:6;24778:2;24766:9;24757:7;24753:23;24749:32;24746:52;;;24794:1;24791;24784:12;24746:52;24834:9;24821:23;24867:18;24859:6;24856:30;24853:50;;;24899:1;24896;24889:12;24853:50;24922:22;;24978:4;24960:16;;;24956:27;24953:47;;;24996:1;24993;24986:12;24953:47;25022:22;;:::i;:::-;25082:2;25069:16;25110:18;25100:8;25097:32;25094:52;;;25142:1;25139;25132:12;25094:52;25169:56;25217:7;25206:8;25202:2;25198:17;25169:56;:::i;:::-;25162:5;25155:71;;25271:2;25267;25263:11;25250:25;25284:33;25309:7;25284:33;:::i;:::-;25344:2;25333:14;;25326:31;25423:2;25415:11;;;25402:25;25443:14;;;25436:31;25512:2;25504:11;;25491:25;25525:30;25491:25;25525:30;:::i;:::-;25582:2;25571:14;;25564:31;25661:3;25653:12;;;25640:26;25682:15;;;25675:32;25752:3;25744:12;;;25731:26;;25766:33;25731:26;25766:33;:::i;:::-;25826:3;25815:15;;25808:32;;;;25819:5;24630:1240;-1:-1:-1;;;24630:1240:76:o;25875:456::-;25963:6;25971;25979;26032:2;26020:9;26011:7;26007:23;26003:32;26000:52;;;26048:1;26045;26038:12;26000:52;-1:-1:-1;;26093:16:76;;26199:2;26184:18;;26178:25;26295:2;26280:18;;;26274:25;26093:16;;26178:25;;-1:-1:-1;26274:25:76;25875:456;-1:-1:-1;25875:456:76:o;26638:617::-;26680:5;26733:3;26726:4;26718:6;26714:17;26710:27;26700:55;;26751:1;26748;26741:12;26700:55;26791:6;26778:20;26821:18;26813:6;26810:30;26807:56;;;26843:18;;:::i;:::-;26887:118;26999:4;-1:-1:-1;;26923:4:76;26915:6;26911:17;26907:90;26903:101;26887:118;:::i;:::-;27030:6;27021:7;27014:23;27084:3;27077:4;27068:6;27060;27056:19;27052:30;27049:39;27046:59;;;27101:1;27098;27091:12;27046:59;27166:6;27159:4;27151:6;27147:17;27140:4;27131:7;27127:18;27114:59;27222:1;27193:20;;;27215:4;27189:31;27182:42;;;;27197:7;26638:617;-1:-1:-1;;;26638:617:76:o;27260:1265::-;27371:6;27379;27432:2;27420:9;27411:7;27407:23;27403:32;27400:52;;;27448:1;27445;27438:12;27400:52;27488:9;27475:23;27521:18;27513:6;27510:30;27507:50;;;27553:1;27550;27543:12;27507:50;27576:49;27617:7;27608:6;27597:9;27593:22;27576:49;:::i;:::-;27566:59;;;27678:2;27667:9;27663:18;27650:32;27707:18;27697:8;27694:32;27691:52;;;27739:1;27736;27729:12;27691:52;27762:24;;27817:4;27809:13;;27805:27;-1:-1:-1;27795:55:76;;27846:1;27843;27836:12;27795:55;27886:2;27873:16;27909:64;27925:47;27965:6;27925:47;:::i;27909:64::-;27995:3;28019:6;28014:3;28007:19;28051:2;28046:3;28042:12;28035:19;;28106:2;28096:6;28093:1;28089:14;28085:2;28081:23;28077:32;28063:46;;28132:7;28124:6;28121:19;28118:39;;;28153:1;28150;28143:12;28118:39;28185:2;28181;28177:11;28197:298;28213:6;28208:3;28205:15;28197:298;;;28299:3;28286:17;28335:18;28322:11;28319:35;28316:55;;;28367:1;28364;28357:12;28316:55;28396:56;28444:7;28439:2;28425:11;28421:2;28417:20;28413:29;28396:56;:::i;:::-;28384:69;;-1:-1:-1;28482:2:76;28473:12;;;;28230;28197:298;;;28201:3;28514:5;28504:15;;;;;;27260:1265;;;;;:::o;28530:524::-;28623:6;28631;28639;28692:2;28680:9;28671:7;28667:23;28663:32;28660:52;;;28708:1;28705;28698:12;28660:52;28747:9;28734:23;28766:31;28791:5;28766:31;:::i;:::-;28816:5;-1:-1:-1;28873:2:76;28858:18;;28845:32;28886:33;28845:32;28886:33;:::i;:::-;28530:524;;28938:7;;-1:-1:-1;;;29018:2:76;29003:18;;;;28990:32;;28530:524::o;29059:245::-;29126:6;29179:2;29167:9;29158:7;29154:23;29150:32;29147:52;;;29195:1;29192;29185:12;29147:52;29227:9;29221:16;29246:28;29268:5;29246:28;:::i","linkReferences":{"V3/src/metarouter/libraries/ClaimsLib.sol":{"ClaimsLib":[{"start":8302,"length":20},{"start":8494,"length":20}]},"V3/src/metarouter/libraries/StakingLib.sol":{"StakingLib":[{"start":7754,"length":20},{"start":8011,"length":20}]},"V3/src/metarouter/libraries/PaymentsLib.sol":{"PaymentsLib":[{"start":5934,"length":20},{"start":6073,"length":20},{"start":6163,"length":20},{"start":6352,"length":20},{"start":6575,"length":20},{"start":6698,"length":20}]},"V3/src/metarouter/libraries/LiquidityLib.sol":{"LiquidityLib":[{"start":7407,"length":20},{"start":7531,"length":20}]},"V3/src/metarouter/libraries/ClPositionLib.sol":{"ClPositionLib":[{"start":6787,"length":20},{"start":6911,"length":20},{"start":7035,"length":20},{"start":7159,"length":20},{"start":7283,"length":20}]},"V3/src/metarouter/libraries/CrosschainLib.sol":{"CrosschainLib":[{"start":8618,"length":20},{"start":8841,"length":20},{"start":9155,"length":20}]},"V3/src/metarouter/libraries/StakeRelayLib.sol":{"StakeRelayLib":[{"start":9403,"length":20},{"start":9651,"length":20}]}},"immutableReferences":{"9188":[{"start":2836,"length":32}],"9192":[{"start":247,"length":32},{"start":901,"length":32},{"start":6215,"length":32},{"start":6388,"length":32},{"start":6438,"length":32},{"start":6611,"length":32}],"9196":[{"start":850,"length":32},{"start":7617,"length":32},{"start":7790,"length":32},{"start":7874,"length":32},{"start":8047,"length":32},{"start":8165,"length":32},{"start":8338,"length":32},{"start":8927,"length":32},{"start":9191,"length":32}],"9200":[{"start":627,"length":32},{"start":8081,"length":32},{"start":8372,"length":32},{"start":9225,"length":32}],"9204":[{"start":799,"length":32},{"start":8654,"length":32},{"start":8704,"length":32},{"start":8877,"length":32}],"9208":[{"start":1121,"length":32},{"start":6823,"length":32},{"start":6947,"length":32},{"start":7071,"length":32},{"start":7195,"length":32},{"start":7319,"length":32},{"start":7443,"length":32},{"start":7567,"length":32},{"start":7824,"length":32},{"start":8115,"length":32},{"start":8406,"length":32},{"start":8530,"length":32},{"start":16420,"length":32}],"9211":[{"start":952,"length":32},{"start":9026,"length":32},{"start":9275,"length":32},{"start":9523,"length":32}],"9215":[{"start":729,"length":32},{"start":9439,"length":32},{"start":9687,"length":32}],"9219":[{"start":402,"length":32},{"start":9473,"length":32}],"9223":[{"start":1070,"length":32},{"start":9721,"length":32}],"9227":[{"start":678,"length":32},{"start":3525,"length":32},{"start":3608,"length":32},{"start":3870,"length":32},{"start":4250,"length":32},{"start":4414,"length":32}],"9230":[{"start":562,"length":32},{"start":3691,"length":32},{"start":4352,"length":32},{"start":4519,"length":32}]}}}}}}},"signatures":{"function":[{"signature":"EMISSION_TOKEN()","signatureHash4":"0x27165e2e","signatureHash32":"0x27165e2e9f3218941d1e25902861c073aa0aa30041509ae0b9434bea91bd0019"},{"signature":"execute(bytes,bytes[],uint256)","signatureHash4":"0x3593564c","signatureHash32":"0x3593564c0e03854874915063081d274d42c12a434f5408440e6c17bae354ee79"},{"signature":"FACTORY_REGISTRY()","signatureHash4":"0xf1cefec2","signatureHash32":"0xf1cefec254bd88ecfe30f47c0e69654bd134592267b5431c111d39d58a32b2e6"},{"signature":"ICA_ROUTER()","signatureHash4":"0x7286c0a6","signatureHash32":"0x7286c0a66dca9977eaaf9698626fd5ca2375dec224a9f8a57a2db31eebd68aaa"},{"signature":"IS_ROOT()","signatureHash4":"0xc001b76d","signatureHash32":"0xc001b76d979f0a379705622f9445938e89045f433d81baca5139dc0ed78b7601"},{"signature":"LEAF_VOTER()","signatureHash4":"0x972ce396","signatureHash32":"0x972ce396347658d98b79526cd948bd5b55c154ced245e186d661cb5797ff9db8"},{"signature":"msgSender()","signatureHash4":"0xd737d0c7","signatureHash32":"0xd737d0c7c0024135268d6fb220d4eff805df4f1e65d2e057ffb5dd61d31af866"},{"signature":"NATIVE_ERC20()","signatureHash4":"0x27d973b4","signatureHash32":"0x27d973b41bdb77f581d9adb73dd2d1f24bbc2c94152327a49b2cfc9d07c4906c"},{"signature":"NATIVE_ERC20_SCALE()","signatureHash4":"0x22c740c1","signatureHash32":"0x22c740c1ae39c0a2bc78bf4aef3b2b8f8baa8d26cf403f5cce15e01d9328b933"},{"signature":"onERC721Received(address,address,uint256,bytes)","signatureHash4":"0x150b7a02","signatureHash32":"0x150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f"},{"signature":"RELAY_FACTORY_REGISTRY()","signatureHash4":"0xee1e230d","signatureHash32":"0xee1e230d3e9797a66afb1a0435fdbb8c5a7847f742a13bf845d25b88b311fd78"},{"signature":"STAKING_ESCROW()","signatureHash4":"0x32218a6c","signatureHash32":"0x32218a6c11f5c9d55885ad56a8235bbc9bc0ea0259235b66b40ec2c90fddeb51"},{"signature":"STAKING_TOKEN()","signatureHash4":"0x0479d644","signatureHash32":"0x0479d64403934ec2676e39a5b26b56d6fed38388201a551a41dfa24bd61d70cd"},{"signature":"uniswapV3SwapCallback(int256,int256,bytes)","signatureHash4":"0xfa461e33","signatureHash32":"0xfa461e33028c3f5ba6fd24f0f40b936af65270d771ddf3e963f1798ed73aadc4"},{"signature":"WETH()","signatureHash4":"0xad5c4648","signatureHash32":"0xad5c46488b7de578b546a5d35cea48a937114e7ed63179543cd1f8e1899a1241"}],"event":[{"signature":"BatchExecuted(address)","signatureHash4":"0x99e09044","signatureHash32":"0x99e0904407d080d7df635d4f68017fa5eb20cfbb1e51c1a6259a218eae490bc1"}],"error":[{"signature":"AmountOverflow()","signatureHash4":"0x0590fb9f","signatureHash32":"0x0590fb9fd7fafa6ed96a184a49c94e739017029af0913ebb670bcdcf7b84d7e5"},{"signature":"BatchNotActive()","signatureHash4":"0xb5cf512a","signatureHash32":"0xb5cf512a13d8d45d72a8fad16186aed82c3a174531e061bebfdc13daf19862b5"},{"signature":"BridgeQuoteExceedsBudget(uint256,uint256)","signatureHash4":"0x70bc3883","signatureHash32":"0x70bc38831362d9e05976275ee3c33e0c6d715b6529a200ca16d8f31735f576fc"},{"signature":"BridgeTokenMismatch()","signatureHash4":"0xee7980d3","signatureHash32":"0xee7980d342c417c1af9ef5ad9476fc91023cfde1287b3ba47ddc79d263edebb3"},{"signature":"CallbackNotCleared(address)","signatureHash4":"0xf785a405","signatureHash32":"0xf785a40542c48e60f54142407bdda204dbfb172fff694464dc1b396cfa0e5564"},{"signature":"CommandDisabled(uint256)","signatureHash4":"0x9c31e5d2","signatureHash32":"0x9c31e5d256938caf8d52693518558595da5cd944c78aa06c9a833df09e0ae25a"},{"signature":"ContractLocked()","signatureHash4":"0x6f5ffb7e","signatureHash32":"0x6f5ffb7e2a6656882126927a79e460ca27ab657927d593522b90dc28229f7dbc"},{"signature":"DirectCallRequired()","signatureHash4":"0x8de9ad8a","signatureHash32":"0x8de9ad8ad571ab8a90bdfa4f6706691d6f808d92adad066107958c76071cf4d3"},{"signature":"Expired()","signatureHash4":"0x203d82d8","signatureHash32":"0x203d82d8d99f63bfecc8335216735e0271df4249ea752b030f9ab305b94e5afe"},{"signature":"FactoryNotApproved()","signatureHash4":"0xa9d8cf68","signatureHash32":"0xa9d8cf687cbb8fc8da19ed20dd6a20ba72ad301a92db6f58f13412f4e4d81333"},{"signature":"GaugeFactoryMismatch(address,address,address)","signatureHash4":"0x54350276","signatureHash32":"0x54350276d9bb3b895d20777a932088311352a6397ab0d706bf8937906b14291d"},{"signature":"GaugeNotRegistered()","signatureHash4":"0x9bc26310","signatureHash32":"0x9bc26310d164ac87ab41f020d1735449b3f248919b76a661000eca9c3166ffd9"},{"signature":"InFlightNftPresent()","signatureHash4":"0xaf1cce90","signatureHash32":"0xaf1cce90c22dae5df176f14c746a9c08a82fe8acccd7ae275cc9684cbd9c2e7d"},{"signature":"InsufficientAmount0()","signatureHash4":"0x7a1689ac","signatureHash32":"0x7a1689acd49c54acbd4ae01a151226f46c216d3e254ad03c8746b16498c3658e"},{"signature":"InsufficientAmount1()","signatureHash4":"0x79d1b9c9","signatureHash32":"0x79d1b9c9c578b4bfb08c6341b4abc914898e47ab65609483f037a8232d4eda48"},{"signature":"InsufficientAmountA()","signatureHash4":"0x8f66ec14","signatureHash32":"0x8f66ec146bd346df5433ee69855986e98f67306bf016fbb7df873dc70fe8e0bd"},{"signature":"InsufficientAmountB()","signatureHash4":"0x34c90624","signatureHash32":"0x34c906248d67a78152acc7acf0aa395e3ffe5a09bd503e8aeb4381022329773a"},{"signature":"InsufficientBalance(address)","signatureHash4":"0x897f6c58","signatureHash32":"0x897f6c58f7b09a7a695bc1b4477556860208a3df666f44a955021ce19789a5f6"},{"signature":"InsufficientLiquidityMinted(uint256,uint256)","signatureHash4":"0x4557e2e0","signatureHash32":"0x4557e2e0afdc35fdafafef90479cde6d1307336e7db294badc405201753ed342"},{"signature":"InvalidAmountOut()","signatureHash4":"0x4e969c58","signatureHash32":"0x4e969c581062704e9a7d1be364137862f9e3ac0107fd6fb99d4b1ba1ac84725f"},{"signature":"InvalidBridgeQuote()","signatureHash4":"0x0ebec38c","signatureHash32":"0x0ebec38c106cad4af1db4b2be7e814f6e908f01c2b53e5bbb1a17b84ecaa466a"},{"signature":"InvalidCallbackCaller(address)","signatureHash4":"0xabae8028","signatureHash32":"0xabae80286d52c305c872cf726ebb644ab528d20de8b9563b813857e8bcf86886"},{"signature":"InvalidCallbackDeltas()","signatureHash4":"0x49133b7d","signatureHash32":"0x49133b7dbb088b676b25d18ad8c1f57bf2c9083d75befe9c198af9dab951585f"},{"signature":"InvalidCommandType(uint256)","signatureHash4":"0xd76a1e9e","signatureHash32":"0xd76a1e9e442555263920e27bf375707f7068bf303f4e4f5f5a523b4d36aa7601"},{"signature":"InvalidEthSender()","signatureHash4":"0x38bbd576","signatureHash32":"0x38bbd57696ce961b04250bce85be3dfb448d6491405f4451bb1dc389c3c210c1"},{"signature":"InvalidGaugeType()","signatureHash4":"0x3ec8776b","signatureHash32":"0x3ec8776bcea68d7d3e2846b123b4fbebef8c0d6c68153118e0fb8f9cbf5d27c8"},{"signature":"InvalidHookMetadata()","signatureHash4":"0xc2869a9d","signatureHash32":"0xc2869a9d28cb973dd8e8fb927a864ec3db17d35b01932e01f926e957f328e7db"},{"signature":"InvalidInterchainAccountConfig()","signatureHash4":"0x5f567ff9","signatureHash32":"0x5f567ff95b53c3d1711ba8211a28ac8988291acb08a6ac9e59aaf757e9ecffdb"},{"signature":"InvalidNativeErc20Decimals()","signatureHash4":"0x12d5a045","signatureHash32":"0x12d5a045aa14f2b0bb9d67fa7ea4140a59ddcb19a16b585495c4ab25d2c38eff"},{"signature":"InvalidNftSender()","signatureHash4":"0x1b532e9b","signatureHash32":"0x1b532e9b137f008eb910f880fc9ecb5246d8d93e6931b891f1ba120b0bd2d048"},{"signature":"InvalidPath()","signatureHash4":"0x20db8267","signatureHash32":"0x20db826769e3af8321787ba1a381ae0528298df9eba27cc33194b460ff8a3602"},{"signature":"InvalidPayer()","signatureHash4":"0x8eb5b891","signatureHash32":"0x8eb5b89126ea635fd698b668e6a27e30cb56c392e5074e6f18ae1d41036e5bba"},{"signature":"InvalidPips(uint256)","signatureHash4":"0x966987d5","signatureHash32":"0x966987d59df58e921bf8190085bb88c7d3ea67c0f36d62ce90330e8aa0ac816d"},{"signature":"InvalidPool(address)","signatureHash4":"0x3d325c6c","signatureHash32":"0x3d325c6ce3b45e6f821e953fdb880b5bc1325c8c5c7c3623e703e97f2331b16d"},{"signature":"InvalidRecipient()","signatureHash4":"0x9c8d2cd2","signatureHash32":"0x9c8d2cd23712ccfbf44b8107cfe79ea09343bf5b458f10860098ac1dbdf69f86"},{"signature":"InvalidReserves(address)","signatureHash4":"0x6cda1440","signatureHash32":"0x6cda14405023850805fce9734d24d254366a7a97cff70788928dab5aa014e5d9"},{"signature":"InvalidSpendMode()","signatureHash4":"0x0be470a3","signatureHash32":"0x0be470a30b1740f0a7ac31d0c8de07d4b245652dd9c829177794e4f898d89868"},{"signature":"InvalidSwapDeltas()","signatureHash4":"0x62f708cd","signatureHash32":"0x62f708cd6a13cbd810b4a4500bd38f9aaf1bf1a06f663d104a7c88c3779f9aef"},{"signature":"LengthMismatch()","signatureHash4":"0xff633a38","signatureHash32":"0xff633a3803c58b9bc21e58efecee59f27e033cc0b1883fccb4969c76146fe60f"},{"signature":"NativeBalanceNotCleared()","signatureHash4":"0x60c79e69","signatureHash32":"0x60c79e696254cdf79bbec73e5dcd8976572a7b48fdc343241708595a818fa934"},{"signature":"NativeTransferFailed(bytes)","signatureHash4":"0xad9ba04a","signatureHash32":"0xad9ba04a0871e81ede1531f462035bf6c6c627bca51a685a10c829398eb9b81d"},{"signature":"NftNotCleared()","signatureHash4":"0xd30e2b5c","signatureHash32":"0xd30e2b5c7e3c675f5fc20f6606081a3ba240fd1e13c4f94622d19d2cdb556d14"},{"signature":"NftNotInCustody()","signatureHash4":"0x7154d75e","signatureHash32":"0x7154d75e3ba7ea9b9d2ba2999246cf26e8eeb1c810568402f3e3a28a072ae900"},{"signature":"NftNotReceived()","signatureHash4":"0x4ebfa1de","signatureHash32":"0x4ebfa1de325903177eb73eca7a016c5566bf541d51f233395bb58136e603648e"},{"signature":"NftSenderNotCleared()","signatureHash4":"0xf4ae38c7","signatureHash32":"0xf4ae38c77ba8a8d20bd4df319b6c5a2fceb80bfba1519fea2cbfa74442e5dff0"},{"signature":"NoInFlightNft()","signatureHash4":"0xf8936f49","signatureHash32":"0xf8936f49faacca50783a06021a757b5046206552e67bafbd489f78314f11b4ba"},{"signature":"NotLeaf(uint256)","signatureHash4":"0x1ce431f3","signatureHash32":"0x1ce431f39d17ed2418c9be4ac2c5a89c1be20a9c2431a94675b3189cf23db206"},{"signature":"NotPositionOwner()","signatureHash4":"0x70d645e3","signatureHash32":"0x70d645e3cffa9bcb1758ab8fc1c18dcbb98086f94ed57c54a3f87fe1e767157c"},{"signature":"NotRoot(uint256)","signatureHash4":"0x68050cb2","signatureHash32":"0x68050cb223b626be32c8eedd4cc6553f777b2dbf17cec66f609a8e115177c4bf"},{"signature":"PenaltyNotAccepted()","signatureHash4":"0xd70e971a","signatureHash32":"0xd70e971ab9a07d53facb597fbb5086fe29469fa4ff9ea9ac1e672c939c731c56"},{"signature":"PoolNotFound()","signatureHash4":"0x76ecffc0","signatureHash32":"0x76ecffc0726de95adbce45221da42faba9f47ca2eeb9cc8dd0d055065aca750a"},{"signature":"PoolNotRegistered()","signatureHash4":"0x739f4185","signatureHash32":"0x739f4185578231940fb0abbbe3ea5fddcae80e859c5658d57ffa5945ec5b6f7a"},{"signature":"PoolTokenMismatch(address)","signatureHash4":"0xf8fae085","signatureHash32":"0xf8fae0854d2d613cc6ecc95c23b946c83a525dd77f4245bd8cd246a378fc6aa6"},{"signature":"PositionManagerFactoryMismatch(address,address)","signatureHash4":"0x25f12b53","signatureHash32":"0x25f12b533419bb1b338162518e54517a3f9a73383db86d3357e5efe9458db972"},{"signature":"PositionManagerNotConfigured(address)","signatureHash4":"0x284cf79a","signatureHash32":"0x284cf79acd8af02f8c9fc26b05114205cd2e1d1f417b500af398c2348a5c8ed7"},{"signature":"PreBatchNativeBalanceSpent()","signatureHash4":"0x53dad583","signatureHash32":"0x53dad5835643bf8416f164c02f1019d97b7485c196853f2f3fe0afb840728d7e"},{"signature":"SafeERC20FailedOperation(address)","signatureHash4":"0x5274afe7","signatureHash32":"0x5274afe73c98b4749fc91ffae6b7b574e7842cb2144a159e9377a5f20b32edf9"},{"signature":"SameDomainCrossCollateralTransfer()","signatureHash4":"0xf4f98040","signatureHash32":"0xf4f9804051ea488fd80e7815a3b06fcbefcc578bd554f5d7c8f44d5af0dffb9a"},{"signature":"TokenFeeExceedsAmount()","signatureHash4":"0x600e59db","signatureHash32":"0x600e59db4e4269f3bf143d955c9d3c08639e202a3cdbcb8442b35ffd7efa5281"},{"signature":"TokenFeeExceedsMax()","signatureHash4":"0xa8eb0fa8","signatureHash32":"0xa8eb0fa84e1d08a3bb41cf3265f97f594420a732da79108d489c892639ac37d8"},{"signature":"TooLittleReceived(uint256,uint256)","signatureHash4":"0x4e86d23a","signatureHash32":"0x4e86d23a7f9a8c7d5e31c6683dae820f0725763209be5efc77dbc63f8c4938cb"},{"signature":"TooMuchRequested()","signatureHash4":"0x24df576f","signatureHash32":"0x24df576f5340a4c937518718001014a27b8cac4f73815411508f2cfadc407ab2"},{"signature":"UnauthorizedRelay()","signatureHash4":"0x5932a85f","signatureHash32":"0x5932a85fea76c02dc3470abb2774fadd3085d8c655244620339311963d50ecef"},{"signature":"UnauthorizedRelayVpm()","signatureHash4":"0x4e287ed3","signatureHash32":"0x4e287ed3ae7d0b9814c4e922b79da4a0cefff383f6024c032edf08330545ef7c"},{"signature":"UnexpectedNftSender()","signatureHash4":"0xc6e0973e","signatureHash32":"0xc6e0973e09d595a1b289c1c833b18616a7d36094fe9f56bd06743e61396e4dc6"},{"signature":"UnregisteredDomain()","signatureHash4":"0x229dea8f","signatureHash32":"0x229dea8f69554f783f18476bc43ad0f096e83fa745aa4a1b87762e10ae8d69cb"},{"signature":"UnsupportedBridgeFeeToken(address)","signatureHash4":"0x5ebfa2a1","signatureHash32":"0x5ebfa2a14b851bb511bee1022d0160d14bc59e392b705965fd01499c42b45ad9"},{"signature":"UnsupportedCrossCollateralToken()","signatureHash4":"0x5eb77806","signatureHash32":"0x5eb77806e5061a5e9eb0385c428ee501ab1525b4cc3433b5c651ecbabdbaaeab"},{"signature":"WethIsNativeErc20()","signatureHash4":"0xce8e5c1e","signatureHash32":"0xce8e5c1ee653a056bc51f3323bf865e10c59fce5e27ab7227d8114461ee1acbe"},{"signature":"ZeroAddress()","signatureHash4":"0xd92e233d","signatureHash32":"0xd92e233df2717d4a40030e20904abd27b68fcbeede117eaaccbbdac9618c8c73"},{"signature":"ZeroAmount()","signatureHash4":"0x1f2a2005","signatureHash32":"0x1f2a2005cb66a8e145327e8814e243a0996aec9bfe1e15a495778b1236dbd485"}]},"proxyResolution":{"isProxy":false,"proxyType":null,"implementations":[]},"match":"match","chainId":"1","address":"0x0fEf9e88A7b76BCDBF451780C6774FE32965Ee98"}