From 87593180544add01550360ba08521d4a37bbfdd4 Mon Sep 17 00:00:00 2001 From: Daniel Wasserman Date: Tue, 15 Oct 2024 13:53:46 -0500 Subject: [PATCH] Update abigen --- .../contracts/fastbridgev2/fastbridgev2.abigen.go | 12 ++++++------ .../fastbridgev2/fastbridgev2.contractinfo.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/services/rfq/contracts/fastbridgev2/fastbridgev2.abigen.go b/services/rfq/contracts/fastbridgev2/fastbridgev2.abigen.go index 3975f8a673..a6518eff27 100644 --- a/services/rfq/contracts/fastbridgev2/fastbridgev2.abigen.go +++ b/services/rfq/contracts/fastbridgev2/fastbridgev2.abigen.go @@ -1827,7 +1827,7 @@ func (_AccessControlEnumerable *AccessControlEnumerableFilterer) ParseRoleRevoke // AddressMetaData contains all meta data concerning the Address contract. var AddressMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"}]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209373c953367c76b94c1908124544fbcf053f6653eb651760b4d42f0f487710d864736f6c63430008180033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ac16750f49f1b9ced08b049feacc7b593708109660ad4859d5e0cc87a7718b8d64736f6c63430008180033", } // AddressABI is the input ABI used to generate the binding from. @@ -2023,7 +2023,7 @@ var AdminMetaData = &bind.MetaData{ "01ffc9a7": "supportsInterface(bytes4)", "06f333f2": "sweepProtocolFees(address,address)", }, - Bin: "0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220e128d8a06a9c2200c4304cd29f76ba6d8295d2c98b16f4a06921d33d0cebefd764736f6c63430008180033", + Bin: "0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220b13443229221519c0fdb3ac2db22c34ccdfff8fd9f142c9a058dcefb00a5a9d864736f6c63430008180033", } // AdminABI is the input ABI used to generate the binding from. @@ -4023,7 +4023,7 @@ func (_ERC165 *ERC165CallerSession) SupportsInterface(interfaceId [4]byte) (bool // EnumerableSetMetaData contains all meta data concerning the EnumerableSet contract. var EnumerableSetMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c93e0a4d209c73a0e712af3f8fe75c461fc5f2c8421cf7a3112f43749245c31a64736f6c63430008180033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122096938e347a6ad7c9db19e62e3fe085fcb6b4b02d667bfa2b5db09e30538dd3cd64736f6c63430008180033", } // EnumerableSetABI is the input ABI used to generate the binding from. @@ -4244,7 +4244,7 @@ var FastBridgeV2MetaData = &bind.MetaData{ "01ffc9a7": "supportsInterface(bytes4)", "06f333f2": "sweepProtocolFees(address,address)", }, - Bin: "0x60c060405260006080523480156200001657600080fd5b5060405162003e5a38038062003e5a833981016040819052620000399162000199565b806200004760008262000054565b50504360a05250620001c4565b60008062000063848462000091565b90508015620000885760008481526001602052604090206200008690846200013f565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000136576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000ed3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016200008b565b5060006200008b565b600062000088836001600160a01b038416600081815260018301602052604081205462000136575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200008b565b600060208284031215620001ac57600080fd5b81516001600160a01b03811681146200008857600080fd5b60805160a051613c70620001ea6000396000610802015260006108a30152613c706000f3fe6080604052600436106102fd5760003560e01c806391ad50391161018f578063b13aa2d6116100e1578063ca15c8731161008a578063dcf844a711610064578063dcf844a714610a50578063df36bb1314610a7d578063e00a83e014610a9357600080fd5b8063ca15c873146109dc578063ccc57490146109fc578063d547741f14610a3057600080fd5b8063bfc7c607116100bb578063bfc7c6071461091c578063c63ff8dd1461092f578063c79371b11461094f57600080fd5b8063b13aa2d6146108c5578063b250fe6b146108e5578063bf333f2c1461090557600080fd5b8063a3ec191a11610143578063ac11fb1a1161011d578063ac11fb1a14610844578063add98c7014610871578063affed0e01461089157600080fd5b8063a3ec191a146107f0578063a5bbe22b14610607578063aa9641ab1461082457600080fd5b8063926d7d7f11610174578063926d7d7f146107945780639c9545f0146107c8578063a217fddf146107db57600080fd5b806391ad5039146106d057806391d148541461075057600080fd5b806341fcb6121161025357806363787e52116101fc578063886d36ff116101d6578063886d36ff146106655780638f0d6f17146106855780639010d07c1461069857600080fd5b806363787e521461058c578063820688d5146106075780638379a24f1461061d57600080fd5b80635960ccf21161022d5780635960ccf21461050b5780635aa6ccba1461053f5780635eb7d9461461056c57600080fd5b806341fcb612146104c257806345851694146104e257806358f85880146104f557600080fd5b806318e4357d116102b5578063295710ff1161028f578063295710ff146104555780632f2ff15d1461048257806336568abe146104a257600080fd5b806318e4357d146103ee578063190da5951461040e578063248a9ca31461042557600080fd5b8063051287bc116102e6578063051287bc1461037957806306f333f2146103b65780630f5f6ed7146103d857600080fd5b806301ffc9a71461030257806303ed0ee514610337575b600080fd5b34801561030e57600080fd5b5061032261031d366004612ee8565b610aa9565b60405190151581526020015b60405180910390f35b34801561034357600080fd5b5061036b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161032e565b34801561038557600080fd5b506103a9610394366004612f2a565b60009081526005602052604090205460ff1690565b60405161032e9190612fad565b3480156103c257600080fd5b506103d66103d1366004612fdb565b610b05565b005b3480156103e457600080fd5b5061036b61271081565b3480156103fa57600080fd5b506103d6610409366004613014565b610bcc565b34801561041a57600080fd5b5061036b62093a8081565b34801561043157600080fd5b5061036b610440366004612f2a565b60009081526020819052604090206001015490565b34801561046157600080fd5b5061036b61047036600461304d565b60076020526000908152604090205481565b34801561048e57600080fd5b506103d661049d36600461306a565b610d39565b3480156104ae57600080fd5b506103d66104bd36600461306a565b610d64565b3480156104ce57600080fd5b506103d66104dd366004613202565b610db0565b6103d66104f0366004613322565b611026565b34801561050157600080fd5b5061036b60025481565b34801561051757600080fd5b5061036b7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561054b57600080fd5b5061055f61055a36600461333f565b611083565b60405161032e91906133cc565b34801561057857600080fd5b506103d661058736600461333f565b611149565b34801561059857600080fd5b506105f76105a7366004612f2a565b60056020526000908152604090205460ff811690610100810464ffffffffff16906601000000000000810465ffffffffffff16906c0100000000000000000000000090046001600160a01b031684565b60405161032e94939291906134e1565b34801561061357600080fd5b5061036b61070881565b34801561062957600080fd5b50610322610638366004612f2a565b6000908152600660205260409020546c0100000000000000000000000090046001600160a01b0316151590565b34801561067157600080fd5b506103d6610680366004613522565b61133e565b6103d661069336600461333f565b611354565b3480156106a457600080fd5b506106b86106b3366004613567565b61135e565b6040516001600160a01b03909116815260200161032e565b3480156106dc57600080fd5b506107246106eb366004612f2a565b600090815260056020526040902054610100810464ffffffffff16916c010000000000000000000000009091046001600160a01b031690565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161032e565b34801561075c57600080fd5b5061032261076b36600461306a565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156107a057600080fd5b5061036b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6103d66107d6366004613202565b61137d565b3480156107e757600080fd5b5061036b600081565b3480156107fc57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561083057600080fd5b5061032261083f36600461306a565b61162e565b34801561085057600080fd5b5061086461085f36600461333f565b611719565b60405161032e9190613589565b34801561087d57600080fd5b506103d661088c366004612f2a565b6118d1565b34801561089d57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156108d157600080fd5b506103d66108e0366004612f2a565b6119f3565b3480156108f157600080fd5b506103d6610900366004612f2a565b611ad5565b34801561091157600080fd5b5061036b620f424081565b6103d661092a36600461366f565b611b3d565b34801561093b57600080fd5b506103d661094a36600461333f565b611dbf565b34801561095b57600080fd5b506109ae61096a366004612f2a565b60066020526000908152604090205465ffffffffffff8082169166010000000000008104909116906c0100000000000000000000000090046001600160a01b031683565b6040805165ffffffffffff94851681529390921660208401526001600160a01b03169082015260600161032e565b3480156109e857600080fd5b5061036b6109f7366004612f2a565b611dca565b348015610a0857600080fd5b5061036b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b348015610a3c57600080fd5b506103d6610a4b36600461306a565b611de1565b348015610a5c57600080fd5b5061036b610a6b36600461304d565b60036020526000908152604090205481565b348015610a8957600080fd5b5061036b61ffff81565b348015610a9f57600080fd5b5061036b60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610aff5750610aff82611e06565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b2f81611e9d565b6001600160a01b03831660009081526003602052604081205490819003610b565750505050565b6001600160a01b038416600081815260036020526040812055610b7a908483611ea7565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610bf681611e9d565b600160008581526005602052604090205460ff166004811115610c1b57610c1b612f43565b14610c52576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260056020908152604091829020805460027fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009091166101004264ffffffffff16027fffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffff161766010000000000004365ffffffffffff160217176bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0387169081029190911790915582518681529251909287927f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e492918290030190a350505050565b600082815260208190526040902060010154610d5481611e9d565b610d5e8383611fca565b50505050565b6001600160a01b0381163314610da6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bc78282611fff565b815160208301206000610dc284611083565b9050600260008381526005602052604090205460ff166004811115610de957610de9612f43565b14610e20576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316610e5d576000828152600560205260409020546c0100000000000000000000000090046001600160a01b03169250610ebd565b6000828152600560205260409020546c0100000000000000000000000090046001600160a01b03163314610ebd576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611610f18576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905561010081015115610f925761010081015160808201516001600160a01b031660009081526003602052604081208054909190610f8c90849061376c565b90915550505b608081015160c0820151610fb06001600160a01b0383168683611ea7565b6000848152600560209081526040918290205482516001600160a01b038681168252928101859052888316936c010000000000000000000000009092049092169187917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac678910160405180910390a4505050505050565b611080816040518060a0016040528060006001600160a01b03168152602001600081526020016040518060200160405280600081525081526020016000815260200160405180602001604052806000815250815250611b3d565b50565b611135604051806101e00160405280600063ffffffff168152602001600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001606081525090565b81806020019051810190610aff91906137da565b80516020820120600061115b83611083565b9050600160008381526005602052604090205460ff16600481111561118257611182612f43565b146111b9576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205460ff161561123357806101400151421161122e576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127f565b62093a80816101400151611247919061376c565b421161127f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166004179055820151608083015161010084015160c0850151929391926112d8919061376c565b90506112ee6001600160a01b0383168483611ea7565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b61135082805190602001208233610bcc565b5050565b611080813361137d565b6000828152600160205260408120611376908361202c565b9392505050565b81516020830120600061138f84611083565b905061139c818385612038565b604080516060808201835265ffffffffffff438116835242811660208085019182526001600160a01b03808a1686880190815260008a8152600690935296909120945185549251965182166c01000000000000000000000000026bffffffffffffffffffffffff9785166601000000000000027fffffffffffffffffffffffffffffffffffffffff000000000000000000000000909416919094161791909117949094161790915582015160a083015160e084015191929091907fffffffffffffffffffffffff1111111111111111111111111111111111111112908316016114fa57610120840151156114bc576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8034146114f5576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154d565b8361012001513414611538576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154d6001600160a01b0383163385846121db565b6101c0840151511561156f5761156a838383876101c00151612257565b61157f565b341561157f5761157f83346123b6565b826001600160a01b0316866001600160a01b0316867ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c876000015188608001518960a001518a60c001518b60e001518c610120015160405161161d9695949392919063ffffffff9690961686526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b60405180910390a450505050505050565b6000600260008481526005602052604090205460ff16600481111561165557611655612f43565b1461168c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020546001600160a01b038381166c0100000000000000000000000090920416146116ef576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060009081526005602052604090205461070861010090910464ffffffffff9081164203161190565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820181905261016082015290517f5aa6ccba0000000000000000000000000000000000000000000000000000000081523090635aa6ccba906117b290859060040161390f565b600060405180830381865afa9250505080156117f057506040513d6000823e601f3d908101601f191682016040526117ed91908101906137da565b60015b6118085781806020019051810190610aff919061392d565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff16815260200182604001516001600160a01b0316815260200182606001516001600160a01b0316815260200182608001516001600160a01b031681526020018260a001516001600160a01b031681526020018260c0015181526020018260e001518152602001826101000151815260200182610120015160001415151581526020018261014001518152602001826101600151815250915050919050565b919050565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6118fb81611e9d565b600260008381526005602052604090205460ff16600481111561192057611920612f43565b14611957576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611156119b3576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560205260408082206001905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611a1d81611e9d565b612710821115611a8e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611aff81611e9d565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101611ac8565b6000816020015142611b4f91906139f9565b9050611b5c83838361247f565b6000611b7084606001518560a00151612704565b90506000806002541115611b9d57620f424060025483611b909190613a21565b611b9a9190613a38565b90505b611ba78183613a73565b91506000604051806101e001604052804663ffffffff168152602001876000015163ffffffff16815260200187602001516001600160a01b0316815260200187604001516001600160a01b0316815260200187606001516001600160a01b0316815260200187608001516001600160a01b031681526020018481526020018760c0015181526020018381526020018660600151815260200187610100015181526020016007600089602001516001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190611c8490613a86565b91905055815260200186600001516001600160a01b031681526020018581526020018660800151815250604051602001611cbe91906133cc565b60408051808303601f1901815282825280516020808301919091206000818152600583529390932080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905589015189516060808c015160808d015160c08e0151928d015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95611d72958b95909493928e9290151590613abe565b60405180910390a3807f3120e2bb59c86aca6890191a589a96af3662838efa374fbdcdf4c95bfe4a6c0e8760400151604051611dae919061390f565b60405180910390a250505050505050565b611080816000610db0565b6000818152600160205260408120610aff906128ad565b600082815260208190526040902060010154611dfc81611e9d565b610d5e8383611fff565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aff57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610aff565b61108081336128b7565b306001600160a01b03831603611ebc57505050565b80600003611ec957505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611fb6576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f46576040519150601f19603f3d011682016040523d82523d6000602084013e611f4b565b606091505b5050905080610d5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401611a85565b610bc76001600160a01b0384168383612923565b600080611fd78484612954565b90508015611376576000848152600160205260409020611ff79084612a1c565b509392505050565b60008061200c8484612a31565b90508015611376576000848152600160205260409020611ff79084612ad2565b60006113768383612ae7565b6001600160a01b038116612078576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660205260409020546c0100000000000000000000000090046001600160a01b0316156120d7576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b4663ffffffff16836020015163ffffffff1614612120576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82610140015142111561215f576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101808301516001600160a01b0316158015906121935750806001600160a01b03168361018001516001600160a01b031614155b80156121a45750826101a001514211155b15610bc7576040517f14be123200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610d5e9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b11565b600083838360405160240161226e93929190613b14565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f461e0c2100000000000000000000000000000000000000000000000000000000179052905060006122d5868334612b8d565b90508051600003612312576040517f1a95ad2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160201461234d576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f461e0c210000000000000000000000000000000000000000000000000000000061237782613b45565b146123ae576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b804710156123f2576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a85565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461243f576040519150601f19603f3d011682016040523d82523d6000602084013e612444565b606091505b5050905080610bc7576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836000015163ffffffff16036124c2576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a083015115806124d5575060c0830151155b1561250c576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208301516001600160a01b03161580612531575060408301516001600160a01b0316155b15612568576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301516001600160a01b0316158061258d575060808301516001600160a01b0316155b156125c4576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6125d06107084261376c565b836101000151101561260e576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff826080015151111561264f576040517ffbe24d4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082015115801590612682575060808301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b156126b9576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811315806126cd575082610100015181135b15610bc7576040517f352807b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016127765734821461276f576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5034610aff565b612788836001600160a01b0316612c43565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa1580156127e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128099190613b8a565b90506128206001600160a01b0384163330856121db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa15801561287f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a39190613b8a565b6113769190613a73565b6000610aff825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611350576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401611a85565b6040516001600160a01b03838116602483015260448201839052610bc791859182169063a9059cbb90606401612210565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16612a14576000838152602081815260408083206001600160a01b0386168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556129cc3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610aff565b506000610aff565b6000611376836001600160a01b038416612ce9565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615612a14576000838152602081815260408083206001600160a01b038616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610aff565b6000611376836001600160a01b038416612d30565b6000826000018281548110612afe57612afe613ba3565b9060005260206000200154905092915050565b6000612b266001600160a01b03841683612e23565b90508051600014158015612b4b575080806020019051810190612b499190613bd2565b155b15610bc7576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401611a85565b606081471015612bcb576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a85565b600080856001600160a01b03168486604051612be79190613bef565b60006040518083038185875af1925050503d8060008114612c24576040519150601f19603f3d011682016040523d82523d6000602084013e612c29565b606091505b5091509150612c39868383612e31565b9695505050505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612ca5576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b600003611080576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600183016020526040812054612a1457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aff565b60008181526001830160205260408120548015612e19576000612d54600183613a73565b8554909150600090612d6890600190613a73565b9050808214612dcd576000866000018281548110612d8857612d88613ba3565b9060005260206000200154905080876000018481548110612dab57612dab613ba3565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612dde57612dde613c0b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aff565b6000915050610aff565b606061137683836000612b8d565b606082612e4657612e4182612ea6565b611376565b8151158015612e5d57506001600160a01b0384163b155b15612e9f576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401611a85565b5080611376565b805115612eb65780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612efa57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461137657600080fd5b600060208284031215612f3c57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60058110612fa9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610aff8284612f72565b6001600160a01b038116811461108057600080fd5b80356118cc81612fbb565b60008060408385031215612fee57600080fd5b8235612ff981612fbb565b9150602083013561300981612fbb565b809150509250929050565b60008060006060848603121561302957600080fd5b8335925060208401359150604084013561304281612fbb565b809150509250925092565b60006020828403121561305f57600080fd5b813561137681612fbb565b6000806040838503121561307d57600080fd5b82359150602083013561300981612fbb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff811182821017156130e2576130e261308f565b60405290565b60405160a0810167ffffffffffffffff811182821017156130e2576130e261308f565b6040516101e0810167ffffffffffffffff811182821017156130e2576130e261308f565b604051610180810167ffffffffffffffff811182821017156130e2576130e261308f565b604051601f8201601f1916810167ffffffffffffffff8111828210171561317c5761317c61308f565b604052919050565b600067ffffffffffffffff82111561319e5761319e61308f565b50601f01601f191660200190565b600082601f8301126131bd57600080fd5b81356131d06131cb82613184565b613153565b8181528460208386010111156131e557600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561321557600080fd5b823567ffffffffffffffff81111561322c57600080fd5b613238858286016131ac565b925050602083013561300981612fbb565b63ffffffff8116811461108057600080fd5b80356118cc81613249565b801515811461108057600080fd5b80356118cc81613266565b6000610120828403121561329257600080fd5b61329a6130be565b90506132a58261325b565b81526132b360208301612fd0565b60208201526132c460408301612fd0565b60408201526132d560608301612fd0565b60608201526132e660808301612fd0565b608082015260a082013560a082015260c082013560c082015261330b60e08301613274565b60e082015261010080830135818301525092915050565b6000610120828403121561333557600080fd5b611376838361327f565b60006020828403121561335157600080fd5b813567ffffffffffffffff81111561336857600080fd5b613374848285016131ac565b949350505050565b60005b8381101561339757818101518382015260200161337f565b50506000910152565b600081518084526133b881602086016020860161337c565b601f01601f19169290920160200192915050565b602081526133e360208201835163ffffffff169052565b600060208301516133fc604084018263ffffffff169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a06134ba818501836001600160a01b03169052565b8401516101c0848101919091528401516101e08085015290506133746102008401826133a0565b608081016134ef8287612f72565b64ffffffffff8516602083015265ffffffffffff841660408301526001600160a01b038316606083015295945050505050565b6000806040838503121561353557600080fd5b823567ffffffffffffffff81111561354c57600080fd5b613558858286016131ac565b95602094909401359450505050565b6000806040838503121561357a57600080fd5b50508035926020909101359150565b815163ffffffff168152610180810160208301516135af602084018263ffffffff169052565b5060408301516135ca60408401826001600160a01b03169052565b5060608301516135e560608401826001600160a01b03169052565b50608083015161360060808401826001600160a01b03169052565b5060a083015161361b60a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516136508285018215159052565b5050610140838101519083015261016092830151929091019190915290565b600080610140838503121561368357600080fd5b61368d848461327f565b915061012083013567ffffffffffffffff808211156136ab57600080fd5b9084019060a082870312156136bf57600080fd5b6136c76130e8565b82356136d281612fbb565b8152602083810135908201526040830135828111156136f057600080fd5b6136fc888286016131ac565b6040830152506060830135606082015260808301358281111561371e57600080fd5b61372a888286016131ac565b6080830152508093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610aff57610aff61373d565b80516118cc81613249565b80516118cc81612fbb565b600082601f8301126137a657600080fd5b81516137b46131cb82613184565b8181528460208386010111156137c957600080fd5b61337482602083016020870161337c565b6000602082840312156137ec57600080fd5b815167ffffffffffffffff8082111561380457600080fd5b908301906101e0828603121561381957600080fd5b61382161310b565b61382a8361377f565b81526138386020840161377f565b60208201526138496040840161378a565b604082015261385a6060840161378a565b606082015261386b6080840161378a565b608082015261387c60a0840161378a565b60a082015260c0838101519082015260e0808401519082015261010080840151908201526101208084015190820152610140808401519082015261016080840151908201526101806138cf81850161378a565b908201526101a083810151908201526101c080840151838111156138f257600080fd5b6138fe88828701613795565b918301919091525095945050505050565b60208152600061137660208301846133a0565b80516118cc81613266565b6000610180828403121561394057600080fd5b61394861312f565b6139518361377f565b815261395f6020840161377f565b60208201526139706040840161378a565b60408201526139816060840161378a565b60608201526139926080840161378a565b60808201526139a360a0840161378a565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206139d6818501613922565b908201526101408381015190820152610160928301519281019290925250919050565b8082018281126000831280158216821582161715613a1957613a1961373d565b505092915050565b8082028115828204841417610aff57610aff61373d565b600082613a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610aff57610aff61373d565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613ab757613ab761373d565b5060010190565b60e081526000613ad160e083018a6133a0565b63ffffffff989098166020830152506001600160a01b039586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b6001600160a01b0384168152826020820152606060408201526000613b3c60608301846133a0565b95945050505050565b80516020808301519190811015613b84577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b600060208284031215613b9c57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613be457600080fd5b815161137681613266565b60008251613c0181846020870161337c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220a3680a17873f4c46b682e496f075c28aef799dbfefc67679607c7ecbffed72b464736f6c63430008180033", + Bin: "0x60c060405260006080523480156200001657600080fd5b5060405162003e6138038062003e61833981016040819052620000399162000199565b806200004760008262000054565b50504360a05250620001c4565b60008062000063848462000091565b90508015620000885760008481526001602052604090206200008690846200013f565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000136576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000ed3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016200008b565b5060006200008b565b600062000088836001600160a01b038416600081815260018301602052604081205462000136575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200008b565b600060208284031215620001ac57600080fd5b81516001600160a01b03811681146200008857600080fd5b60805160a051613c77620001ea6000396000610802015260006108a30152613c776000f3fe6080604052600436106102fd5760003560e01c806391ad50391161018f578063b13aa2d6116100e1578063ca15c8731161008a578063dcf844a711610064578063dcf844a714610a50578063df36bb1314610a7d578063e00a83e014610a9357600080fd5b8063ca15c873146109dc578063ccc57490146109fc578063d547741f14610a3057600080fd5b8063bfc7c607116100bb578063bfc7c6071461091c578063c63ff8dd1461092f578063c79371b11461094f57600080fd5b8063b13aa2d6146108c5578063b250fe6b146108e5578063bf333f2c1461090557600080fd5b8063a3ec191a11610143578063ac11fb1a1161011d578063ac11fb1a14610844578063add98c7014610871578063affed0e01461089157600080fd5b8063a3ec191a146107f0578063a5bbe22b14610607578063aa9641ab1461082457600080fd5b8063926d7d7f11610174578063926d7d7f146107945780639c9545f0146107c8578063a217fddf146107db57600080fd5b806391ad5039146106d057806391d148541461075057600080fd5b806341fcb6121161025357806363787e52116101fc578063886d36ff116101d6578063886d36ff146106655780638f0d6f17146106855780639010d07c1461069857600080fd5b806363787e521461058c578063820688d5146106075780638379a24f1461061d57600080fd5b80635960ccf21161022d5780635960ccf21461050b5780635aa6ccba1461053f5780635eb7d9461461056c57600080fd5b806341fcb612146104c257806345851694146104e257806358f85880146104f557600080fd5b806318e4357d116102b5578063295710ff1161028f578063295710ff146104555780632f2ff15d1461048257806336568abe146104a257600080fd5b806318e4357d146103ee578063190da5951461040e578063248a9ca31461042557600080fd5b8063051287bc116102e6578063051287bc1461037957806306f333f2146103b65780630f5f6ed7146103d857600080fd5b806301ffc9a71461030257806303ed0ee514610337575b600080fd5b34801561030e57600080fd5b5061032261031d366004612eef565b610aa9565b60405190151581526020015b60405180910390f35b34801561034357600080fd5b5061036b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161032e565b34801561038557600080fd5b506103a9610394366004612f31565b60009081526005602052604090205460ff1690565b60405161032e9190612fb4565b3480156103c257600080fd5b506103d66103d1366004612fe2565b610b05565b005b3480156103e457600080fd5b5061036b61271081565b3480156103fa57600080fd5b506103d661040936600461301b565b610bcc565b34801561041a57600080fd5b5061036b62093a8081565b34801561043157600080fd5b5061036b610440366004612f31565b60009081526020819052604090206001015490565b34801561046157600080fd5b5061036b610470366004613054565b60076020526000908152604090205481565b34801561048e57600080fd5b506103d661049d366004613071565b610d39565b3480156104ae57600080fd5b506103d66104bd366004613071565b610d64565b3480156104ce57600080fd5b506103d66104dd366004613209565b610db0565b6103d66104f0366004613329565b611026565b34801561050157600080fd5b5061036b60025481565b34801561051757600080fd5b5061036b7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561054b57600080fd5b5061055f61055a366004613346565b611083565b60405161032e91906133d3565b34801561057857600080fd5b506103d6610587366004613346565b611149565b34801561059857600080fd5b506105f76105a7366004612f31565b60056020526000908152604090205460ff811690610100810464ffffffffff16906601000000000000810465ffffffffffff16906c0100000000000000000000000090046001600160a01b031684565b60405161032e94939291906134e8565b34801561061357600080fd5b5061036b61070881565b34801561062957600080fd5b50610322610638366004612f31565b6000908152600660205260409020546c0100000000000000000000000090046001600160a01b0316151590565b34801561067157600080fd5b506103d6610680366004613529565b61133e565b6103d6610693366004613346565b611354565b3480156106a457600080fd5b506106b86106b336600461356e565b61135e565b6040516001600160a01b03909116815260200161032e565b3480156106dc57600080fd5b506107246106eb366004612f31565b600090815260056020526040902054610100810464ffffffffff16916c010000000000000000000000009091046001600160a01b031690565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161032e565b34801561075c57600080fd5b5061032261076b366004613071565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156107a057600080fd5b5061036b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6103d66107d6366004613209565b61137d565b3480156107e757600080fd5b5061036b600081565b3480156107fc57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561083057600080fd5b5061032261083f366004613071565b611603565b34801561085057600080fd5b5061086461085f366004613346565b6116ee565b60405161032e9190613590565b34801561087d57600080fd5b506103d661088c366004612f31565b6118a6565b34801561089d57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156108d157600080fd5b506103d66108e0366004612f31565b6119c8565b3480156108f157600080fd5b506103d6610900366004612f31565b611aaa565b34801561091157600080fd5b5061036b620f424081565b6103d661092a366004613676565b611b12565b34801561093b57600080fd5b506103d661094a366004613346565b611d94565b34801561095b57600080fd5b506109ae61096a366004612f31565b60066020526000908152604090205465ffffffffffff8082169166010000000000008104909116906c0100000000000000000000000090046001600160a01b031683565b6040805165ffffffffffff94851681529390921660208401526001600160a01b03169082015260600161032e565b3480156109e857600080fd5b5061036b6109f7366004612f31565b611d9f565b348015610a0857600080fd5b5061036b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b348015610a3c57600080fd5b506103d6610a4b366004613071565b611db6565b348015610a5c57600080fd5b5061036b610a6b366004613054565b60036020526000908152604090205481565b348015610a8957600080fd5b5061036b61ffff81565b348015610a9f57600080fd5b5061036b60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610aff5750610aff82611ddb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b2f81611e72565b6001600160a01b03831660009081526003602052604081205490819003610b565750505050565b6001600160a01b038416600081815260036020526040812055610b7a908483611e7c565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610bf681611e72565b600160008581526005602052604090205460ff166004811115610c1b57610c1b612f4a565b14610c52576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260056020908152604091829020805460027fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009091166101004264ffffffffff16027fffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffff161766010000000000004365ffffffffffff160217176bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0387169081029190911790915582518681529251909287927f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e492918290030190a350505050565b600082815260208190526040902060010154610d5481611e72565b610d5e8383611f9f565b50505050565b6001600160a01b0381163314610da6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bc78282611fd4565b815160208301206000610dc284611083565b9050600260008381526005602052604090205460ff166004811115610de957610de9612f4a565b14610e20576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316610e5d576000828152600560205260409020546c0100000000000000000000000090046001600160a01b03169250610ebd565b6000828152600560205260409020546c0100000000000000000000000090046001600160a01b03163314610ebd576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611610f18576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905561010081015115610f925761010081015160808201516001600160a01b031660009081526003602052604081208054909190610f8c908490613773565b90915550505b608081015160c0820151610fb06001600160a01b0383168683611e7c565b6000848152600560209081526040918290205482516001600160a01b038681168252928101859052888316936c010000000000000000000000009092049092169187917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac678910160405180910390a4505050505050565b611080816040518060a0016040528060006001600160a01b03168152602001600081526020016040518060200160405280600081525081526020016000815260200160405180602001604052806000815250815250611b12565b50565b611135604051806101e00160405280600063ffffffff168152602001600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001606081525090565b81806020019051810190610aff91906137e1565b80516020820120600061115b83611083565b9050600160008381526005602052604090205460ff16600481111561118257611182612f4a565b146111b9576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205460ff161561123357806101400151421161122e576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127f565b62093a808161014001516112479190613773565b421161127f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166004179055820151608083015161010084015160c0850151929391926112d89190613773565b90506112ee6001600160a01b0383168483611e7c565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b61135082805190602001208233610bcc565b5050565b611080813361137d565b60008281526001602052604081206113769083612001565b9392505050565b81516020830120600061138f84611083565b905061139c81838561200d565b604080516060808201835265ffffffffffff438116835242811660208085019182526001600160a01b0389811686880181815260008b815260068552899020975188549551915184166c01000000000000000000000000026bffffffffffffffffffffffff9288166601000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090971691909716179490941793909316939093179094558583015160a08088015160e08901516101208a01518a516080808d015160c0808f01518e5163ffffffff9095168552918b169c84019c909c52858a169c83019c909c529881019a909a52968901819052918801869052919691959094938716929189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c910160405180910390a47fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161157957801561153b576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b813414611574576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115c7565b8034146115b2576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115c76001600160a01b0384163386856121aa565b6101c085015151156115e9576115e4848484886101c00151612226565b6115f9565b34156115f9576115f98434612385565b5050505050505050565b6000600260008481526005602052604090205460ff16600481111561162a5761162a612f4a565b14611661576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020546001600160a01b038381166c0100000000000000000000000090920416146116c4576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060009081526005602052604090205461070861010090910464ffffffffff9081164203161190565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820181905261016082015290517f5aa6ccba0000000000000000000000000000000000000000000000000000000081523090635aa6ccba90611787908590600401613916565b600060405180830381865afa9250505080156117c557506040513d6000823e601f3d908101601f191682016040526117c291908101906137e1565b60015b6117dd5781806020019051810190610aff9190613934565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff16815260200182604001516001600160a01b0316815260200182606001516001600160a01b0316815260200182608001516001600160a01b031681526020018260a001516001600160a01b031681526020018260c0015181526020018260e001518152602001826101000151815260200182610120015160001415151581526020018261014001518152602001826101600151815250915050919050565b919050565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6118d081611e72565b600260008381526005602052604090205460ff1660048111156118f5576118f5612f4a565b1461192c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff9081164203161115611988576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560205260408082206001905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556119f281611e72565b612710821115611a63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611ad481611e72565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101611a9d565b6000816020015142611b249190613a00565b9050611b3183838361244e565b6000611b4584606001518560a001516126d3565b90506000806002541115611b7257620f424060025483611b659190613a28565b611b6f9190613a3f565b90505b611b7c8183613a7a565b91506000604051806101e001604052804663ffffffff168152602001876000015163ffffffff16815260200187602001516001600160a01b0316815260200187604001516001600160a01b0316815260200187606001516001600160a01b0316815260200187608001516001600160a01b031681526020018481526020018760c0015181526020018381526020018660600151815260200187610100015181526020016007600089602001516001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190611c5990613a8d565b91905055815260200186600001516001600160a01b031681526020018581526020018660800151815250604051602001611c9391906133d3565b60408051808303601f1901815282825280516020808301919091206000818152600583529390932080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905589015189516060808c015160808d015160c08e0151928d015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95611d47958b95909493928e9290151590613ac5565b60405180910390a3807f3120e2bb59c86aca6890191a589a96af3662838efa374fbdcdf4c95bfe4a6c0e8760400151604051611d839190613916565b60405180910390a250505050505050565b611080816000610db0565b6000818152600160205260408120610aff906128b4565b600082815260208190526040902060010154611dd181611e72565b610d5e8383611fd4565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aff57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610aff565b61108081336128be565b306001600160a01b03831603611e9157505050565b80600003611e9e57505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611f8b576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f1b576040519150601f19603f3d011682016040523d82523d6000602084013e611f20565b606091505b5050905080610d5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401611a5a565b610bc76001600160a01b038416838361292a565b600080611fac848461295b565b90508015611376576000848152600160205260409020611fcc9084612a23565b509392505050565b600080611fe18484612a38565b90508015611376576000848152600160205260409020611fcc9084612ad9565b60006113768383612aee565b6001600160a01b03811661204d576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660205260409020546c0100000000000000000000000090046001600160a01b0316156120ac576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836020015163ffffffff16146120ef576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82610140015142111561212e576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101808301516001600160a01b0316158015906121625750806001600160a01b03168361018001516001600160a01b031614155b80156121735750826101a001514211155b15610bc7576040517f14be123200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610d5e9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b18565b600083838360405160240161223d93929190613b1b565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f461e0c2100000000000000000000000000000000000000000000000000000000179052905060006122a4868334612b94565b905080516000036122e1576040517f1a95ad2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160201461231c576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f461e0c210000000000000000000000000000000000000000000000000000000061234682613b4c565b1461237d576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b804710156123c1576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a5a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461240e576040519150601f19603f3d011682016040523d82523d6000602084013e612413565b606091505b5050905080610bc7576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836000015163ffffffff1603612491576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a083015115806124a4575060c0830151155b156124db576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208301516001600160a01b03161580612500575060408301516001600160a01b0316155b15612537576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301516001600160a01b0316158061255c575060808301516001600160a01b0316155b15612593576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61259f61070842613773565b83610100015110156125dd576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff826080015151111561261e576040517ffbe24d4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082015115801590612651575060808301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15612688576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008113158061269c575082610100015181135b15610bc7576040517f352807b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016127455734821461273e576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5034610aff565b612757836001600160a01b0316612c4a565b341561278f576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa1580156127ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128109190613b91565b90506128276001600160a01b0384163330856121aa565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa158015612886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128aa9190613b91565b6113769190613a7a565b6000610aff825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611350576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401611a5a565b6040516001600160a01b03838116602483015260448201839052610bc791859182169063a9059cbb906064016121df565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16612a1b576000838152602081815260408083206001600160a01b0386168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556129d33390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610aff565b506000610aff565b6000611376836001600160a01b038416612cf0565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615612a1b576000838152602081815260408083206001600160a01b038616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610aff565b6000611376836001600160a01b038416612d37565b6000826000018281548110612b0557612b05613baa565b9060005260206000200154905092915050565b6000612b2d6001600160a01b03841683612e2a565b90508051600014158015612b52575080806020019051810190612b509190613bd9565b155b15610bc7576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401611a5a565b606081471015612bd2576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a5a565b600080856001600160a01b03168486604051612bee9190613bf6565b60006040518083038185875af1925050503d8060008114612c2b576040519150601f19603f3d011682016040523d82523d6000602084013e612c30565b606091505b5091509150612c40868383612e38565b9695505050505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612cac576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b600003611080576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600183016020526040812054612a1b57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aff565b60008181526001830160205260408120548015612e20576000612d5b600183613a7a565b8554909150600090612d6f90600190613a7a565b9050808214612dd4576000866000018281548110612d8f57612d8f613baa565b9060005260206000200154905080876000018481548110612db257612db2613baa565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612de557612de5613c12565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aff565b6000915050610aff565b606061137683836000612b94565b606082612e4d57612e4882612ead565b611376565b8151158015612e6457506001600160a01b0384163b155b15612ea6576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401611a5a565b5080611376565b805115612ebd5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612f0157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461137657600080fd5b600060208284031215612f4357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60058110612fb0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610aff8284612f79565b6001600160a01b038116811461108057600080fd5b80356118a181612fc2565b60008060408385031215612ff557600080fd5b823561300081612fc2565b9150602083013561301081612fc2565b809150509250929050565b60008060006060848603121561303057600080fd5b8335925060208401359150604084013561304981612fc2565b809150509250925092565b60006020828403121561306657600080fd5b813561137681612fc2565b6000806040838503121561308457600080fd5b82359150602083013561301081612fc2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff811182821017156130e9576130e9613096565b60405290565b60405160a0810167ffffffffffffffff811182821017156130e9576130e9613096565b6040516101e0810167ffffffffffffffff811182821017156130e9576130e9613096565b604051610180810167ffffffffffffffff811182821017156130e9576130e9613096565b604051601f8201601f1916810167ffffffffffffffff8111828210171561318357613183613096565b604052919050565b600067ffffffffffffffff8211156131a5576131a5613096565b50601f01601f191660200190565b600082601f8301126131c457600080fd5b81356131d76131d28261318b565b61315a565b8181528460208386010111156131ec57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561321c57600080fd5b823567ffffffffffffffff81111561323357600080fd5b61323f858286016131b3565b925050602083013561301081612fc2565b63ffffffff8116811461108057600080fd5b80356118a181613250565b801515811461108057600080fd5b80356118a18161326d565b6000610120828403121561329957600080fd5b6132a16130c5565b90506132ac82613262565b81526132ba60208301612fd7565b60208201526132cb60408301612fd7565b60408201526132dc60608301612fd7565b60608201526132ed60808301612fd7565b608082015260a082013560a082015260c082013560c082015261331260e0830161327b565b60e082015261010080830135818301525092915050565b6000610120828403121561333c57600080fd5b6113768383613286565b60006020828403121561335857600080fd5b813567ffffffffffffffff81111561336f57600080fd5b61337b848285016131b3565b949350505050565b60005b8381101561339e578181015183820152602001613386565b50506000910152565b600081518084526133bf816020860160208601613383565b601f01601f19169290920160200192915050565b602081526133ea60208201835163ffffffff169052565b60006020830151613403604084018263ffffffff169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a06134c1818501836001600160a01b03169052565b8401516101c0848101919091528401516101e080850152905061337b6102008401826133a7565b608081016134f68287612f79565b64ffffffffff8516602083015265ffffffffffff841660408301526001600160a01b038316606083015295945050505050565b6000806040838503121561353c57600080fd5b823567ffffffffffffffff81111561355357600080fd5b61355f858286016131b3565b95602094909401359450505050565b6000806040838503121561358157600080fd5b50508035926020909101359150565b815163ffffffff168152610180810160208301516135b6602084018263ffffffff169052565b5060408301516135d160408401826001600160a01b03169052565b5060608301516135ec60608401826001600160a01b03169052565b50608083015161360760808401826001600160a01b03169052565b5060a083015161362260a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516136578285018215159052565b5050610140838101519083015261016092830151929091019190915290565b600080610140838503121561368a57600080fd5b6136948484613286565b915061012083013567ffffffffffffffff808211156136b257600080fd5b9084019060a082870312156136c657600080fd5b6136ce6130ef565b82356136d981612fc2565b8152602083810135908201526040830135828111156136f757600080fd5b613703888286016131b3565b6040830152506060830135606082015260808301358281111561372557600080fd5b613731888286016131b3565b6080830152508093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610aff57610aff613744565b80516118a181613250565b80516118a181612fc2565b600082601f8301126137ad57600080fd5b81516137bb6131d28261318b565b8181528460208386010111156137d057600080fd5b61337b826020830160208701613383565b6000602082840312156137f357600080fd5b815167ffffffffffffffff8082111561380b57600080fd5b908301906101e0828603121561382057600080fd5b613828613112565b61383183613786565b815261383f60208401613786565b602082015261385060408401613791565b604082015261386160608401613791565b606082015261387260808401613791565b608082015261388360a08401613791565b60a082015260c0838101519082015260e0808401519082015261010080840151908201526101208084015190820152610140808401519082015261016080840151908201526101806138d6818501613791565b908201526101a083810151908201526101c080840151838111156138f957600080fd5b6139058882870161379c565b918301919091525095945050505050565b60208152600061137660208301846133a7565b80516118a18161326d565b6000610180828403121561394757600080fd5b61394f613136565b61395883613786565b815261396660208401613786565b602082015261397760408401613791565b604082015261398860608401613791565b606082015261399960808401613791565b60808201526139aa60a08401613791565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206139dd818501613929565b908201526101408381015190820152610160928301519281019290925250919050565b8082018281126000831280158216821582161715613a2057613a20613744565b505092915050565b8082028115828204841417610aff57610aff613744565b600082613a75577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610aff57610aff613744565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613abe57613abe613744565b5060010190565b60e081526000613ad860e083018a6133a7565b63ffffffff989098166020830152506001600160a01b039586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b6001600160a01b0384168152826020820152606060408201526000613b4360608301846133a7565b95945050505050565b80516020808301519190811015613b8b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b600060208284031215613ba357600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613beb57600080fd5b81516113768161326d565b60008251613c08818460208701613383565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220fef42b85b97e95ca087836390d97d99307ec60b38cd20d26ea0f113c18a0660d64736f6c63430008180033", } // FastBridgeV2ABI is the input ABI used to generate the binding from. @@ -14352,7 +14352,7 @@ func (_IFastBridgeV2Errors *IFastBridgeV2ErrorsTransactorRaw) Transact(opts *bin // SafeERC20MetaData contains all meta data concerning the SafeERC20 contract. var SafeERC20MetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"currentAllowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestedDecrease\",\"type\":\"uint256\"}],\"name\":\"SafeERC20FailedDecreaseAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"}]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202e6244574a9418b179bbe1f5d6f1483cf0da887e64158bb04463fae84495de4464736f6c63430008180033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220bf9b4d830342bc19a7972f35e2bc28e74742724839e41d049e96167e6d81d6ea64736f6c63430008180033", } // SafeERC20ABI is the input ABI used to generate the binding from. @@ -14525,7 +14525,7 @@ func (_SafeERC20 *SafeERC20TransactorRaw) Transact(opts *bind.TransactOpts, meth // UniversalTokenLibMetaData contains all meta data concerning the UniversalTokenLib contract. var UniversalTokenLibMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f32c0660d6e44933a56619135234122fa7c42eeae2b3df059ed3d1e4d3c16aa264736f6c63430008180033", + Bin: "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122030abe7c99e33645ff08fba6fd46ebf752f2157cc4f5e930a35e81633f8aacbb864736f6c63430008180033", } // UniversalTokenLibABI is the input ABI used to generate the binding from. diff --git a/services/rfq/contracts/fastbridgev2/fastbridgev2.contractinfo.json b/services/rfq/contracts/fastbridgev2/fastbridgev2.contractinfo.json index f7b2869bb1..1ead51fc19 100644 --- a/services/rfq/contracts/fastbridgev2/fastbridgev2.contractinfo.json +++ b/services/rfq/contracts/fastbridgev2/fastbridgev2.contractinfo.json @@ -1 +1 @@ -{"solidity/FastBridgeV2.sol:AccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Contract module that allows children to implement role-based access control mechanisms. This is a lightweight version that doesn't allow enumerating role members except through off-chain means by accessing the contract event logs. Some applications may benefit from on-chain enumerability, for those cases see {AccessControlEnumerable}. Roles are referred to by their `bytes32` identifier. These should be exposed in the external API and be unique. The best way to achieve this is by using `public constant` hash digests: ```solidity bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\"); ``` Roles can be used to represent a set of permissions. To restrict access to a function call, use {hasRole}: ```solidity function foo() public { require(hasRole(MY_ROLE, msg.sender)); ... } ``` Roles can be granted and revoked dynamically via the {grantRole} and {revokeRole} functions. Each role has an associated admin role, and only accounts that have a role's admin role can call {grantRole} and {revokeRole}. By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means that only accounts with this role will be able to grant or revoke other roles. More complex role relationships can be created by using {_setRoleAdmin}. WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to grant and revoke this role. Extra precautions should be taken to secure accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} to enforce additional security measures for this role.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Contract module that allows children to implement role-based access control mechanisms. This is a lightweight version that doesn't allow enumerating role members except through off-chain means by accessing the contract event logs. Some applications may benefit from on-chain enumerability, for those cases see {AccessControlEnumerable}. Roles are referred to by their `bytes32` identifier. These should be exposed in the external API and be unique. The best way to achieve this is by using `public constant` hash digests: ```solidity bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\"); ``` Roles can be used to represent a set of permissions. To restrict access to a function call, use {hasRole}: ```solidity function foo() public { require(hasRole(MY_ROLE, msg.sender)); ... } ``` Roles can be granted and revoked dynamically via the {grantRole} and {revokeRole} functions. Each role has an associated admin role, and only accounts that have a role's admin role can call {grantRole} and {revokeRole}. By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means that only accounts with this role will be able to grant or revoke other roles. More complex role relationships can be created by using {_setRoleAdmin}. WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to grant and revoke this role. Extra precautions should be taken to secure accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} to enforce additional security measures for this role.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"AccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:AccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Extension of {AccessControl} that allows enumerating the members of each role.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Extension of {AccessControl} that allows enumerating the members of each role.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"AccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:Address":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209373c953367c76b94c1908124544fbcf053f6653eb651760b4d42f0f487710d864736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212209373c953367c76b94c1908124544fbcf053f6653eb651760b4d42f0f487710d864736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"16564:6066:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;16564:6066:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"16564:6066:0:-:0;;;;;;;;","abiDefinition":[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Collection of functions related to the address type","errors":{"AddressEmptyCode(address)":[{"details":"There's no code at `target` (it is not a contract)."}],"AddressInsufficientBalance(address)":[{"details":"The ETH balance of the account is not enough to perform the operation."}],"FailedInnerCall()":[{"details":"A call to an address target failed. The target may have reverted."}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Collection of functions related to the address type\",\"errors\":{\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:Admin":{"code":"0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220e128d8a06a9c2200c4304cd29f76ba6d8295d2c98b16f4a06921d33d0cebefd764736f6c63430008180033","runtime-code":"0x608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220e128d8a06a9c2200c4304cd29f76ba6d8295d2c98b16f4a06921d33d0cebefd764736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"62810:1843:0:-:0;;;63637:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;63675:38;52847:4;63706:6;63675:10;:38::i;:::-;;63637:83;62810:1843;;62160:257;62246:4;;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62318:69;62403:7;-1:-1:-1;62160:257:0;;;;;:::o;56794:316::-;56871:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;-1:-1:-1;;;;;56930:29:0;;;;;;;;;:36;;-1:-1:-1;;56930:36:0;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;-1:-1:-1;;;;;56985:40:0;57003:7;-1:-1:-1;;;;;56985:40:0;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;-1:-1:-1;;;;;32931:23:0;;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;14:290:1;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:1;;214:42;;204:70;;270:1;267;260:12;14:290;62810:1843:0;;;;;;","srcMapRuntime":"62810:1843:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60820:212;;;;;;:::i;:::-;;:::i;:::-;;;516:14:1;;509:22;491:41;;479:2;464:18;60820:212:0;;;;;;;;63050:60;;63087:23;63050:60;;;;;689:25:1;;;677:2;662:18;63050:60:0;543:177:1;64022:359:0;;;;;;:::i;:::-;;:::i;:::-;;63232:45;;63271:6;63232:45;;54425:120;;;;;;:::i;:::-;54490:7;54516:12;;;;;;;;;;:22;;;;54425:120;54841:136;;;;;;:::i;:::-;;:::i;55943:245::-;;;;;;:::i;:::-;;:::i;63394:30::-;;;;;;62978:66;;63018:26;62978:66;;61617:142;;;;;;:::i;:::-;;:::i;:::-;;;2246:42:1;2234:55;;;2216:74;;2204:2;2189:18;61617:142:0;2070:226:1;53469:136:0;;;;;;:::i;:::-;53546:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;53469:136;62908:64;;62947:25;62908:64;;52802:49;;52847:4;52802:49;;63726:290;;;;;;:::i;:::-;;:::i;64387:264::-;;;;;;:::i;:::-;;:::i;63189:37::-;;63223:3;63189:37;;61927:131;;;;;;:::i;:::-;;:::i;63116:66::-;;63156:26;63116:66;;55257:138;;;;;;:::i;:::-;;:::i;63480:47::-;;;;;;:::i;:::-;;;;;;;;;;;;;;63601:29;;;;;;60820:212;60905:4;60928:57;;;60943:42;60928:57;;:97;;;60989:36;61013:11;60989:23;:36::i;:::-;60921:104;60820:212;-1:-1:-1;;60820:212:0:o;64022:359::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;64146:19:::1;::::0;::::1;64126:17;64146:19:::0;;;:12:::1;:19;::::0;;;;;;64179:14;;;64175:27:::1;;64195:7;64022:359:::0;;;:::o;64175:27::-:1;64243:19;::::0;::::1;64265:1;64243:19:::0;;;:12:::1;:19;::::0;;;;:23;64276:45:::1;::::0;64300:9;64311;64276:23:::1;:45::i;:::-;64336:38;::::0;;2889:42:1;2958:15;;;2940:34;;3010:15;;3005:2;2990:18;;2983:43;3042:18;;;3035:34;;;64336:38:0::1;::::0;2867:2:1;2852:18;64336:38:0::1;;;;;;;64116:265;53105:1;64022:359:::0;;;:::o;54841:136::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;54945:25:::1;54956:4;54962:7;54945:10;:25::i;:::-;;54841:136:::0;;;:::o;55943:245::-;56036:34;;;23368:10;56036:34;56032:102;;56093:30;;;;;;;;;;;;;;56032:102;56144:37;56156:4;56162:18;56144:11;:37::i;61617:142::-;61698:7;61724:18;;;:12;:18;;;;;:28;;61746:5;61724:21;:28::i;:::-;61717:35;61617:142;-1:-1:-1;;;61617:142:0:o;63726:290::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;63271:6:::1;63825:10;:26;;63817:55;;;::::0;::::1;::::0;;3282:2:1;63817:55:0::1;::::0;::::1;3264:21:1::0;3321:2;3301:18;;;3294:30;3360:18;3340;;;3333:46;3396:18;;63817:55:0::1;;;;;;;;;63903:15;::::0;;63928:28;;;;63971:38:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;63971:38:0::1;::::0;3572:18:1;63971:38:0::1;;;;;;;;63807:209;63726:290:::0;;:::o;64387:264::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;64512:14:::1;::::0;;64536:34;;;;64585:59:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;64585:59:0::1;::::0;3572:18:1;64585:59:0::1;3425:248:1::0;61927:131:0;61998:7;62024:18;;;:12;:18;;;;;:27;;:25;:27::i;55257:138::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;55362:26:::1;55374:4;55380:7;55362:11;:26::i;53180:202::-:0;53265:4;53288:47;;;53303:32;53288:47;;:87;;-1:-1:-1;45095:25:0;45080:40;;;;53339:36;44981:146;53814:103;53880:30;53891:4;23368:10;53880;:30::i;:::-;53814:103;:::o;58092:653::-;58267:4;58253:19;;;;58249:32;;58092:653;;;:::o;58249:32::-;58353:5;58362:1;58353:10;58349:23;;58092:653;;;:::o;58349:23::-;58385:20;;;;;58381:358;;58565:12;58582:2;:7;;58597:5;58582:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;58564:43;;;58629:7;58621:39;;;;;;;4090:2:1;58621:39:0;;;4072:21:1;4129:2;4109:18;;;4102:30;4168:21;4148:18;;;4141:49;4207:18;;58621:39:0;3888:343:1;58381:358:0;58691:37;:26;;;58718:2;58722:5;58691:26;:37::i;62160:257::-;62246:4;62262:12;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62403:7;62160:257;-1:-1:-1;;;62160:257:0:o;62520:262::-;62607:4;62623:12;62638:32;62656:4;62662:7;62638:17;:32::i;:::-;62623:47;;62684:7;62680:72;;;62707:18;;;;:12;:18;;;;;:34;;62733:7;62707:25;:34::i;34071:156::-;34145:7;34195:22;34199:3;34211:5;34195:3;:22::i;33614:115::-;33677:7;33703:19;33711:3;29053:18;;28971:107;54047:197;53546:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;54130:108;;54180:47;;;;;4440:42:1;4428:55;;54180:47:0;;;4410:74:1;4500:18;;;4493:34;;;4383:18;;54180:47:0;4236:297:1;54130:108:0;54047:197;;:::o;46297:160::-;46406:43;;;46421:14;4428:55:1;;46406:43:0;;;4410:74:1;4500:18;;;;4493:34;;;46406:43:0;;;;;;;;;;4383:18:1;;;;46406:43:0;;;;;;;;;;;;;;46379:71;;46399:5;;46379:19;:71::i;56794:316::-;56871:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;56985:40;;57003:7;56985:40;;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;32931:23;;;32906:4;:50::i;57345:317::-;57423:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;57439:217;;;57513:5;57481:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;57537:40;23368:10;;57481:12;;57537:40;;57513:5;57537:40;-1:-1:-1;57598:4:0;57591:11;;33131:156;33204:4;33227:53;33235:3;33255:23;;;33227:7;:53::i;29420:118::-;29487:7;29513:3;:11;;29525:5;29513:18;;;;;;;;:::i;:::-;;;;;;;;;29506:25;;29420:118;;;;:::o;49053:629::-;49472:23;49498:33;:27;;;49526:4;49498:27;:33::i;:::-;49472:59;;49545:10;:17;49566:1;49545:22;;:57;;;;;49583:10;49572:30;;;;;;;;;;;;:::i;:::-;49571:31;49545:57;49541:135;;;49625:40;;;;;2246:42:1;2234:55;;49625:40:0;;;2216:74:1;2189:18;;49625:40:0;2070:226:1;26738:406:0;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;27312:1368;27378:4;27507:21;;;:14;;;:21;;;;;;27543:13;;27539:1135;;27910:18;27931:12;27942:1;27931:8;:12;:::i;:::-;27977:18;;27910:33;;-1:-1:-1;27957:17:0;;27977:22;;27998:1;;27977:22;:::i;:::-;27957:42;;28032:9;28018:10;:23;28014:378;;28061:17;28081:3;:11;;28093:9;28081:22;;;;;;;;:::i;:::-;;;;;;;;;28061:42;;28228:9;28202:3;:11;;28214:10;28202:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;28341:25;;;:14;;;:25;;;;;:36;;;28014:378;28470:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;28573:3;:14;;:21;28588:5;28573:21;;;;;;;;;;;28566:28;;;28616:4;28609:11;;;;;;;27539:1135;28658:5;28651:12;;;;;19074:151;19149:12;19180:38;19202:6;19210:4;19216:1;19149:12;19790;19804:23;19831:6;:11;;19850:5;19857:4;19831:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19789:73;;;;19879:55;19906:6;19914:7;19923:10;19879:26;:55::i;:::-;19872:62;19549:392;-1:-1:-1;;;;;;19549:392:0:o;20994:582::-;21138:12;21167:7;21162:408;;21190:19;21198:10;21190:7;:19::i;:::-;21162:408;;;21414:17;;:22;:49;;;;-1:-1:-1;21440:18:0;;;;:23;21414:49;21410:119;;;21490:24;;;;;2246:42:1;2234:55;;21490:24:0;;;2216:74:1;2189:18;;21490:24:0;2070:226:1;21410:119:0;-1:-1:-1;21549:10:0;21542:17;;22112:516;22243:17;;:21;22239:383;;22471:10;22465:17;22527:15;22514:10;22510:2;22506:19;22499:44;22239:383;22594:17;;;;;;;;;;;;;;14:332:1;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;180:9;167:23;230:66;223:5;219:78;212:5;209:89;199:117;;312:1;309;302:12;725:196;793:20;;853:42;842:54;;832:65;;822:93;;911:1;908;901:12;822:93;725:196;;;:::o;926:260::-;994:6;1002;1055:2;1043:9;1034:7;1030:23;1026:32;1023:52;;;1071:1;1068;1061:12;1023:52;1094:29;1113:9;1094:29;:::i;:::-;1084:39;;1142:38;1176:2;1165:9;1161:18;1142:38;:::i;:::-;1132:48;;926:260;;;;;:::o;1373:180::-;1432:6;1485:2;1473:9;1464:7;1460:23;1456:32;1453:52;;;1501:1;1498;1491:12;1453:52;-1:-1:-1;1524:23:1;;1373:180;-1:-1:-1;1373:180:1:o;1558:254::-;1626:6;1634;1687:2;1675:9;1666:7;1662:23;1658:32;1655:52;;;1703:1;1700;1693:12;1655:52;1739:9;1726:23;1716:33;;1768:38;1802:2;1791:9;1787:18;1768:38;:::i;1817:248::-;1885:6;1893;1946:2;1934:9;1925:7;1921:23;1917:32;1914:52;;;1962:1;1959;1952:12;1914:52;-1:-1:-1;;1985:23:1;;;2055:2;2040:18;;;2027:32;;-1:-1:-1;1817:248:1:o;2486:186::-;2545:6;2598:2;2586:9;2577:7;2573:23;2569:32;2566:52;;;2614:1;2611;2604:12;2566:52;2637:29;2656:9;2637:29;:::i;4840:184::-;4892:77;4889:1;4882:88;4989:4;4986:1;4979:15;5013:4;5010:1;5003:15;5029:277;5096:6;5149:2;5137:9;5128:7;5124:23;5120:32;5117:52;;;5165:1;5162;5155:12;5117:52;5197:9;5191:16;5250:5;5243:13;5236:21;5229:5;5226:32;5216:60;;5272:1;5269;5262:12;5311:282;5378:9;;;5399:11;;;5396:191;;;5443:77;5440:1;5433:88;5544:4;5541:1;5534:15;5572:4;5569:1;5562:15;5598:184;5650:77;5647:1;5640:88;5747:4;5744:1;5737:15;5771:4;5768:1;5761:15;5787:412;5916:3;5954:6;5948:13;5979:1;5989:129;6003:6;6000:1;5997:13;5989:129;;;6101:4;6085:14;;;6081:25;;6075:32;6062:11;;;6055:53;6018:12;5989:129;;;-1:-1:-1;6173:1:1;6137:16;;6162:13;;;-1:-1:-1;6137:16:1;5787:412;-1:-1:-1;5787:412:1:o","abiDefinition":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldChainGasAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"ChainGasAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesSwept","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RATE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARD_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFUNDER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainGasAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"protocolFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"setChainGasAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"setProtocolFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{"chainGasAmount()":{"notice":"Chain gas amount to forward as rebate if requested"},"protocolFeeRate()":{"notice":"Protocol fee rate taken on origin amount deposited in origin chain"},"protocolFees(address)":{"notice":"Protocol fee amounts accumulated"}},"version":1},"developerDoc":{"errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}],"AddressEmptyCode(address)":[{"details":"There's no code at `target` (it is not a contract)."}],"AddressInsufficientBalance(address)":[{"details":"The ETH balance of the account is not enough to perform the operation."}],"FailedInnerCall()":[{"details":"A call to an address target failed. The target may have reverted."}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC20 token failed."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldChainGasAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"ChainGasAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldFeeRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"FeeRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FeesSwept\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_BPS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_RATE_MAX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOVERNOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GUARD_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REFUNDER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"chainGasAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"protocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"setChainGasAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"sweepProtocolFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}],\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainGasAmount()\":{\"notice\":\"Chain gas amount to forward as rebate if requested\"},\"protocolFeeRate()\":{\"notice\":\"Protocol fee rate taken on origin amount deposited in origin chain\"},\"protocolFees(address)\":{\"notice\":\"Protocol fee amounts accumulated\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"Admin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","REFUNDER_ROLE()":"5960ccf2","RELAYER_ROLE()":"926d7d7f","chainGasAmount()":"e00a83e0","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","protocolFeeRate()":"58f85880","protocolFees(address)":"dcf844a7","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeV2.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.","kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:ERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ```","kind":"dev","methods":{"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ```\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"ERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:EnumerableSet":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c93e0a4d209c73a0e712af3f8fe75c461fc5f2c8421cf7a3112f43749245c31a64736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220c93e0a4d209c73a0e712af3f8fe75c461fc5f2c8421cf7a3112f43749245c31a64736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"25827:11640:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;25827:11640:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"25827:11640:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Library for managing https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive types. Sets have the following properties: - Elements are added, removed, and checked for existence in constant time (O(1)). - Elements are enumerated in O(n). No guarantees are made on the ordering. ```solidity contract Example { // Add the library methods using EnumerableSet for EnumerableSet.AddressSet; // Declare a set state variable EnumerableSet.AddressSet private mySet; } ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) and `uint256` (`UintSet`) are supported. [WARNING] ==== Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. ====","kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for managing https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive types. Sets have the following properties: - Elements are added, removed, and checked for existence in constant time (O(1)). - Elements are enumerated in O(n). No guarantees are made on the ordering. ```solidity contract Example { // Add the library methods using EnumerableSet for EnumerableSet.AddressSet; // Declare a set state variable EnumerableSet.AddressSet private mySet; } ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) and `uint256` (`UintSet`) are supported. [WARNING] ==== Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. ====\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"EnumerableSet\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:FastBridgeV2":{"code":"0x60c060405260006080523480156200001657600080fd5b5060405162003e5a38038062003e5a833981016040819052620000399162000199565b806200004760008262000054565b50504360a05250620001c4565b60008062000063848462000091565b90508015620000885760008481526001602052604090206200008690846200013f565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000136576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000ed3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016200008b565b5060006200008b565b600062000088836001600160a01b038416600081815260018301602052604081205462000136575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200008b565b600060208284031215620001ac57600080fd5b81516001600160a01b03811681146200008857600080fd5b60805160a051613c70620001ea6000396000610802015260006108a30152613c706000f3fe6080604052600436106102fd5760003560e01c806391ad50391161018f578063b13aa2d6116100e1578063ca15c8731161008a578063dcf844a711610064578063dcf844a714610a50578063df36bb1314610a7d578063e00a83e014610a9357600080fd5b8063ca15c873146109dc578063ccc57490146109fc578063d547741f14610a3057600080fd5b8063bfc7c607116100bb578063bfc7c6071461091c578063c63ff8dd1461092f578063c79371b11461094f57600080fd5b8063b13aa2d6146108c5578063b250fe6b146108e5578063bf333f2c1461090557600080fd5b8063a3ec191a11610143578063ac11fb1a1161011d578063ac11fb1a14610844578063add98c7014610871578063affed0e01461089157600080fd5b8063a3ec191a146107f0578063a5bbe22b14610607578063aa9641ab1461082457600080fd5b8063926d7d7f11610174578063926d7d7f146107945780639c9545f0146107c8578063a217fddf146107db57600080fd5b806391ad5039146106d057806391d148541461075057600080fd5b806341fcb6121161025357806363787e52116101fc578063886d36ff116101d6578063886d36ff146106655780638f0d6f17146106855780639010d07c1461069857600080fd5b806363787e521461058c578063820688d5146106075780638379a24f1461061d57600080fd5b80635960ccf21161022d5780635960ccf21461050b5780635aa6ccba1461053f5780635eb7d9461461056c57600080fd5b806341fcb612146104c257806345851694146104e257806358f85880146104f557600080fd5b806318e4357d116102b5578063295710ff1161028f578063295710ff146104555780632f2ff15d1461048257806336568abe146104a257600080fd5b806318e4357d146103ee578063190da5951461040e578063248a9ca31461042557600080fd5b8063051287bc116102e6578063051287bc1461037957806306f333f2146103b65780630f5f6ed7146103d857600080fd5b806301ffc9a71461030257806303ed0ee514610337575b600080fd5b34801561030e57600080fd5b5061032261031d366004612ee8565b610aa9565b60405190151581526020015b60405180910390f35b34801561034357600080fd5b5061036b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161032e565b34801561038557600080fd5b506103a9610394366004612f2a565b60009081526005602052604090205460ff1690565b60405161032e9190612fad565b3480156103c257600080fd5b506103d66103d1366004612fdb565b610b05565b005b3480156103e457600080fd5b5061036b61271081565b3480156103fa57600080fd5b506103d6610409366004613014565b610bcc565b34801561041a57600080fd5b5061036b62093a8081565b34801561043157600080fd5b5061036b610440366004612f2a565b60009081526020819052604090206001015490565b34801561046157600080fd5b5061036b61047036600461304d565b60076020526000908152604090205481565b34801561048e57600080fd5b506103d661049d36600461306a565b610d39565b3480156104ae57600080fd5b506103d66104bd36600461306a565b610d64565b3480156104ce57600080fd5b506103d66104dd366004613202565b610db0565b6103d66104f0366004613322565b611026565b34801561050157600080fd5b5061036b60025481565b34801561051757600080fd5b5061036b7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561054b57600080fd5b5061055f61055a36600461333f565b611083565b60405161032e91906133cc565b34801561057857600080fd5b506103d661058736600461333f565b611149565b34801561059857600080fd5b506105f76105a7366004612f2a565b60056020526000908152604090205460ff811690610100810464ffffffffff16906601000000000000810465ffffffffffff16906c0100000000000000000000000090046001600160a01b031684565b60405161032e94939291906134e1565b34801561061357600080fd5b5061036b61070881565b34801561062957600080fd5b50610322610638366004612f2a565b6000908152600660205260409020546c0100000000000000000000000090046001600160a01b0316151590565b34801561067157600080fd5b506103d6610680366004613522565b61133e565b6103d661069336600461333f565b611354565b3480156106a457600080fd5b506106b86106b3366004613567565b61135e565b6040516001600160a01b03909116815260200161032e565b3480156106dc57600080fd5b506107246106eb366004612f2a565b600090815260056020526040902054610100810464ffffffffff16916c010000000000000000000000009091046001600160a01b031690565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161032e565b34801561075c57600080fd5b5061032261076b36600461306a565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156107a057600080fd5b5061036b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6103d66107d6366004613202565b61137d565b3480156107e757600080fd5b5061036b600081565b3480156107fc57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561083057600080fd5b5061032261083f36600461306a565b61162e565b34801561085057600080fd5b5061086461085f36600461333f565b611719565b60405161032e9190613589565b34801561087d57600080fd5b506103d661088c366004612f2a565b6118d1565b34801561089d57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156108d157600080fd5b506103d66108e0366004612f2a565b6119f3565b3480156108f157600080fd5b506103d6610900366004612f2a565b611ad5565b34801561091157600080fd5b5061036b620f424081565b6103d661092a36600461366f565b611b3d565b34801561093b57600080fd5b506103d661094a36600461333f565b611dbf565b34801561095b57600080fd5b506109ae61096a366004612f2a565b60066020526000908152604090205465ffffffffffff8082169166010000000000008104909116906c0100000000000000000000000090046001600160a01b031683565b6040805165ffffffffffff94851681529390921660208401526001600160a01b03169082015260600161032e565b3480156109e857600080fd5b5061036b6109f7366004612f2a565b611dca565b348015610a0857600080fd5b5061036b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b348015610a3c57600080fd5b506103d6610a4b36600461306a565b611de1565b348015610a5c57600080fd5b5061036b610a6b36600461304d565b60036020526000908152604090205481565b348015610a8957600080fd5b5061036b61ffff81565b348015610a9f57600080fd5b5061036b60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610aff5750610aff82611e06565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b2f81611e9d565b6001600160a01b03831660009081526003602052604081205490819003610b565750505050565b6001600160a01b038416600081815260036020526040812055610b7a908483611ea7565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610bf681611e9d565b600160008581526005602052604090205460ff166004811115610c1b57610c1b612f43565b14610c52576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260056020908152604091829020805460027fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009091166101004264ffffffffff16027fffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffff161766010000000000004365ffffffffffff160217176bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0387169081029190911790915582518681529251909287927f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e492918290030190a350505050565b600082815260208190526040902060010154610d5481611e9d565b610d5e8383611fca565b50505050565b6001600160a01b0381163314610da6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bc78282611fff565b815160208301206000610dc284611083565b9050600260008381526005602052604090205460ff166004811115610de957610de9612f43565b14610e20576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316610e5d576000828152600560205260409020546c0100000000000000000000000090046001600160a01b03169250610ebd565b6000828152600560205260409020546c0100000000000000000000000090046001600160a01b03163314610ebd576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611610f18576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905561010081015115610f925761010081015160808201516001600160a01b031660009081526003602052604081208054909190610f8c90849061376c565b90915550505b608081015160c0820151610fb06001600160a01b0383168683611ea7565b6000848152600560209081526040918290205482516001600160a01b038681168252928101859052888316936c010000000000000000000000009092049092169187917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac678910160405180910390a4505050505050565b611080816040518060a0016040528060006001600160a01b03168152602001600081526020016040518060200160405280600081525081526020016000815260200160405180602001604052806000815250815250611b3d565b50565b611135604051806101e00160405280600063ffffffff168152602001600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001606081525090565b81806020019051810190610aff91906137da565b80516020820120600061115b83611083565b9050600160008381526005602052604090205460ff16600481111561118257611182612f43565b146111b9576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205460ff161561123357806101400151421161122e576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127f565b62093a80816101400151611247919061376c565b421161127f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166004179055820151608083015161010084015160c0850151929391926112d8919061376c565b90506112ee6001600160a01b0383168483611ea7565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b61135082805190602001208233610bcc565b5050565b611080813361137d565b6000828152600160205260408120611376908361202c565b9392505050565b81516020830120600061138f84611083565b905061139c818385612038565b604080516060808201835265ffffffffffff438116835242811660208085019182526001600160a01b03808a1686880190815260008a8152600690935296909120945185549251965182166c01000000000000000000000000026bffffffffffffffffffffffff9785166601000000000000027fffffffffffffffffffffffffffffffffffffffff000000000000000000000000909416919094161791909117949094161790915582015160a083015160e084015191929091907fffffffffffffffffffffffff1111111111111111111111111111111111111112908316016114fa57610120840151156114bc576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8034146114f5576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154d565b8361012001513414611538576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154d6001600160a01b0383163385846121db565b6101c0840151511561156f5761156a838383876101c00151612257565b61157f565b341561157f5761157f83346123b6565b826001600160a01b0316866001600160a01b0316867ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c876000015188608001518960a001518a60c001518b60e001518c610120015160405161161d9695949392919063ffffffff9690961686526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b60405180910390a450505050505050565b6000600260008481526005602052604090205460ff16600481111561165557611655612f43565b1461168c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020546001600160a01b038381166c0100000000000000000000000090920416146116ef576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060009081526005602052604090205461070861010090910464ffffffffff9081164203161190565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820181905261016082015290517f5aa6ccba0000000000000000000000000000000000000000000000000000000081523090635aa6ccba906117b290859060040161390f565b600060405180830381865afa9250505080156117f057506040513d6000823e601f3d908101601f191682016040526117ed91908101906137da565b60015b6118085781806020019051810190610aff919061392d565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff16815260200182604001516001600160a01b0316815260200182606001516001600160a01b0316815260200182608001516001600160a01b031681526020018260a001516001600160a01b031681526020018260c0015181526020018260e001518152602001826101000151815260200182610120015160001415151581526020018261014001518152602001826101600151815250915050919050565b919050565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6118fb81611e9d565b600260008381526005602052604090205460ff16600481111561192057611920612f43565b14611957576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611156119b3576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560205260408082206001905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611a1d81611e9d565b612710821115611a8e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611aff81611e9d565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101611ac8565b6000816020015142611b4f91906139f9565b9050611b5c83838361247f565b6000611b7084606001518560a00151612704565b90506000806002541115611b9d57620f424060025483611b909190613a21565b611b9a9190613a38565b90505b611ba78183613a73565b91506000604051806101e001604052804663ffffffff168152602001876000015163ffffffff16815260200187602001516001600160a01b0316815260200187604001516001600160a01b0316815260200187606001516001600160a01b0316815260200187608001516001600160a01b031681526020018481526020018760c0015181526020018381526020018660600151815260200187610100015181526020016007600089602001516001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190611c8490613a86565b91905055815260200186600001516001600160a01b031681526020018581526020018660800151815250604051602001611cbe91906133cc565b60408051808303601f1901815282825280516020808301919091206000818152600583529390932080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905589015189516060808c015160808d015160c08e0151928d015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95611d72958b95909493928e9290151590613abe565b60405180910390a3807f3120e2bb59c86aca6890191a589a96af3662838efa374fbdcdf4c95bfe4a6c0e8760400151604051611dae919061390f565b60405180910390a250505050505050565b611080816000610db0565b6000818152600160205260408120610aff906128ad565b600082815260208190526040902060010154611dfc81611e9d565b610d5e8383611fff565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aff57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610aff565b61108081336128b7565b306001600160a01b03831603611ebc57505050565b80600003611ec957505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611fb6576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f46576040519150601f19603f3d011682016040523d82523d6000602084013e611f4b565b606091505b5050905080610d5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401611a85565b610bc76001600160a01b0384168383612923565b600080611fd78484612954565b90508015611376576000848152600160205260409020611ff79084612a1c565b509392505050565b60008061200c8484612a31565b90508015611376576000848152600160205260409020611ff79084612ad2565b60006113768383612ae7565b6001600160a01b038116612078576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660205260409020546c0100000000000000000000000090046001600160a01b0316156120d7576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b4663ffffffff16836020015163ffffffff1614612120576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82610140015142111561215f576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101808301516001600160a01b0316158015906121935750806001600160a01b03168361018001516001600160a01b031614155b80156121a45750826101a001514211155b15610bc7576040517f14be123200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610d5e9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b11565b600083838360405160240161226e93929190613b14565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f461e0c2100000000000000000000000000000000000000000000000000000000179052905060006122d5868334612b8d565b90508051600003612312576040517f1a95ad2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160201461234d576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f461e0c210000000000000000000000000000000000000000000000000000000061237782613b45565b146123ae576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b804710156123f2576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a85565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461243f576040519150601f19603f3d011682016040523d82523d6000602084013e612444565b606091505b5050905080610bc7576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836000015163ffffffff16036124c2576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a083015115806124d5575060c0830151155b1561250c576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208301516001600160a01b03161580612531575060408301516001600160a01b0316155b15612568576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301516001600160a01b0316158061258d575060808301516001600160a01b0316155b156125c4576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6125d06107084261376c565b836101000151101561260e576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff826080015151111561264f576040517ffbe24d4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082015115801590612682575060808301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b156126b9576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811315806126cd575082610100015181135b15610bc7576040517f352807b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016127765734821461276f576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5034610aff565b612788836001600160a01b0316612c43565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa1580156127e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128099190613b8a565b90506128206001600160a01b0384163330856121db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa15801561287f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a39190613b8a565b6113769190613a73565b6000610aff825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611350576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401611a85565b6040516001600160a01b03838116602483015260448201839052610bc791859182169063a9059cbb90606401612210565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16612a14576000838152602081815260408083206001600160a01b0386168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556129cc3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610aff565b506000610aff565b6000611376836001600160a01b038416612ce9565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615612a14576000838152602081815260408083206001600160a01b038616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610aff565b6000611376836001600160a01b038416612d30565b6000826000018281548110612afe57612afe613ba3565b9060005260206000200154905092915050565b6000612b266001600160a01b03841683612e23565b90508051600014158015612b4b575080806020019051810190612b499190613bd2565b155b15610bc7576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401611a85565b606081471015612bcb576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a85565b600080856001600160a01b03168486604051612be79190613bef565b60006040518083038185875af1925050503d8060008114612c24576040519150601f19603f3d011682016040523d82523d6000602084013e612c29565b606091505b5091509150612c39868383612e31565b9695505050505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612ca5576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b600003611080576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600183016020526040812054612a1457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aff565b60008181526001830160205260408120548015612e19576000612d54600183613a73565b8554909150600090612d6890600190613a73565b9050808214612dcd576000866000018281548110612d8857612d88613ba3565b9060005260206000200154905080876000018481548110612dab57612dab613ba3565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612dde57612dde613c0b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aff565b6000915050610aff565b606061137683836000612b8d565b606082612e4657612e4182612ea6565b611376565b8151158015612e5d57506001600160a01b0384163b155b15612e9f576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401611a85565b5080611376565b805115612eb65780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612efa57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461137657600080fd5b600060208284031215612f3c57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60058110612fa9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610aff8284612f72565b6001600160a01b038116811461108057600080fd5b80356118cc81612fbb565b60008060408385031215612fee57600080fd5b8235612ff981612fbb565b9150602083013561300981612fbb565b809150509250929050565b60008060006060848603121561302957600080fd5b8335925060208401359150604084013561304281612fbb565b809150509250925092565b60006020828403121561305f57600080fd5b813561137681612fbb565b6000806040838503121561307d57600080fd5b82359150602083013561300981612fbb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff811182821017156130e2576130e261308f565b60405290565b60405160a0810167ffffffffffffffff811182821017156130e2576130e261308f565b6040516101e0810167ffffffffffffffff811182821017156130e2576130e261308f565b604051610180810167ffffffffffffffff811182821017156130e2576130e261308f565b604051601f8201601f1916810167ffffffffffffffff8111828210171561317c5761317c61308f565b604052919050565b600067ffffffffffffffff82111561319e5761319e61308f565b50601f01601f191660200190565b600082601f8301126131bd57600080fd5b81356131d06131cb82613184565b613153565b8181528460208386010111156131e557600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561321557600080fd5b823567ffffffffffffffff81111561322c57600080fd5b613238858286016131ac565b925050602083013561300981612fbb565b63ffffffff8116811461108057600080fd5b80356118cc81613249565b801515811461108057600080fd5b80356118cc81613266565b6000610120828403121561329257600080fd5b61329a6130be565b90506132a58261325b565b81526132b360208301612fd0565b60208201526132c460408301612fd0565b60408201526132d560608301612fd0565b60608201526132e660808301612fd0565b608082015260a082013560a082015260c082013560c082015261330b60e08301613274565b60e082015261010080830135818301525092915050565b6000610120828403121561333557600080fd5b611376838361327f565b60006020828403121561335157600080fd5b813567ffffffffffffffff81111561336857600080fd5b613374848285016131ac565b949350505050565b60005b8381101561339757818101518382015260200161337f565b50506000910152565b600081518084526133b881602086016020860161337c565b601f01601f19169290920160200192915050565b602081526133e360208201835163ffffffff169052565b600060208301516133fc604084018263ffffffff169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a06134ba818501836001600160a01b03169052565b8401516101c0848101919091528401516101e08085015290506133746102008401826133a0565b608081016134ef8287612f72565b64ffffffffff8516602083015265ffffffffffff841660408301526001600160a01b038316606083015295945050505050565b6000806040838503121561353557600080fd5b823567ffffffffffffffff81111561354c57600080fd5b613558858286016131ac565b95602094909401359450505050565b6000806040838503121561357a57600080fd5b50508035926020909101359150565b815163ffffffff168152610180810160208301516135af602084018263ffffffff169052565b5060408301516135ca60408401826001600160a01b03169052565b5060608301516135e560608401826001600160a01b03169052565b50608083015161360060808401826001600160a01b03169052565b5060a083015161361b60a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516136508285018215159052565b5050610140838101519083015261016092830151929091019190915290565b600080610140838503121561368357600080fd5b61368d848461327f565b915061012083013567ffffffffffffffff808211156136ab57600080fd5b9084019060a082870312156136bf57600080fd5b6136c76130e8565b82356136d281612fbb565b8152602083810135908201526040830135828111156136f057600080fd5b6136fc888286016131ac565b6040830152506060830135606082015260808301358281111561371e57600080fd5b61372a888286016131ac565b6080830152508093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610aff57610aff61373d565b80516118cc81613249565b80516118cc81612fbb565b600082601f8301126137a657600080fd5b81516137b46131cb82613184565b8181528460208386010111156137c957600080fd5b61337482602083016020870161337c565b6000602082840312156137ec57600080fd5b815167ffffffffffffffff8082111561380457600080fd5b908301906101e0828603121561381957600080fd5b61382161310b565b61382a8361377f565b81526138386020840161377f565b60208201526138496040840161378a565b604082015261385a6060840161378a565b606082015261386b6080840161378a565b608082015261387c60a0840161378a565b60a082015260c0838101519082015260e0808401519082015261010080840151908201526101208084015190820152610140808401519082015261016080840151908201526101806138cf81850161378a565b908201526101a083810151908201526101c080840151838111156138f257600080fd5b6138fe88828701613795565b918301919091525095945050505050565b60208152600061137660208301846133a0565b80516118cc81613266565b6000610180828403121561394057600080fd5b61394861312f565b6139518361377f565b815261395f6020840161377f565b60208201526139706040840161378a565b60408201526139816060840161378a565b60608201526139926080840161378a565b60808201526139a360a0840161378a565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206139d6818501613922565b908201526101408381015190820152610160928301519281019290925250919050565b8082018281126000831280158216821582161715613a1957613a1961373d565b505092915050565b8082028115828204841417610aff57610aff61373d565b600082613a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610aff57610aff61373d565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613ab757613ab761373d565b5060010190565b60e081526000613ad160e083018a6133a0565b63ffffffff989098166020830152506001600160a01b039586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b6001600160a01b0384168152826020820152606060408201526000613b3c60608301846133a0565b95945050505050565b80516020808301519190811015613b84577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b600060208284031215613b9c57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613be457600080fd5b815161137681613266565b60008251613c0181846020870161337c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220a3680a17873f4c46b682e496f075c28aef799dbfefc67679607c7ecbffed72b464736f6c63430008180033","runtime-code":"0x6080604052600436106102fd5760003560e01c806391ad50391161018f578063b13aa2d6116100e1578063ca15c8731161008a578063dcf844a711610064578063dcf844a714610a50578063df36bb1314610a7d578063e00a83e014610a9357600080fd5b8063ca15c873146109dc578063ccc57490146109fc578063d547741f14610a3057600080fd5b8063bfc7c607116100bb578063bfc7c6071461091c578063c63ff8dd1461092f578063c79371b11461094f57600080fd5b8063b13aa2d6146108c5578063b250fe6b146108e5578063bf333f2c1461090557600080fd5b8063a3ec191a11610143578063ac11fb1a1161011d578063ac11fb1a14610844578063add98c7014610871578063affed0e01461089157600080fd5b8063a3ec191a146107f0578063a5bbe22b14610607578063aa9641ab1461082457600080fd5b8063926d7d7f11610174578063926d7d7f146107945780639c9545f0146107c8578063a217fddf146107db57600080fd5b806391ad5039146106d057806391d148541461075057600080fd5b806341fcb6121161025357806363787e52116101fc578063886d36ff116101d6578063886d36ff146106655780638f0d6f17146106855780639010d07c1461069857600080fd5b806363787e521461058c578063820688d5146106075780638379a24f1461061d57600080fd5b80635960ccf21161022d5780635960ccf21461050b5780635aa6ccba1461053f5780635eb7d9461461056c57600080fd5b806341fcb612146104c257806345851694146104e257806358f85880146104f557600080fd5b806318e4357d116102b5578063295710ff1161028f578063295710ff146104555780632f2ff15d1461048257806336568abe146104a257600080fd5b806318e4357d146103ee578063190da5951461040e578063248a9ca31461042557600080fd5b8063051287bc116102e6578063051287bc1461037957806306f333f2146103b65780630f5f6ed7146103d857600080fd5b806301ffc9a71461030257806303ed0ee514610337575b600080fd5b34801561030e57600080fd5b5061032261031d366004612ee8565b610aa9565b60405190151581526020015b60405180910390f35b34801561034357600080fd5b5061036b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161032e565b34801561038557600080fd5b506103a9610394366004612f2a565b60009081526005602052604090205460ff1690565b60405161032e9190612fad565b3480156103c257600080fd5b506103d66103d1366004612fdb565b610b05565b005b3480156103e457600080fd5b5061036b61271081565b3480156103fa57600080fd5b506103d6610409366004613014565b610bcc565b34801561041a57600080fd5b5061036b62093a8081565b34801561043157600080fd5b5061036b610440366004612f2a565b60009081526020819052604090206001015490565b34801561046157600080fd5b5061036b61047036600461304d565b60076020526000908152604090205481565b34801561048e57600080fd5b506103d661049d36600461306a565b610d39565b3480156104ae57600080fd5b506103d66104bd36600461306a565b610d64565b3480156104ce57600080fd5b506103d66104dd366004613202565b610db0565b6103d66104f0366004613322565b611026565b34801561050157600080fd5b5061036b60025481565b34801561051757600080fd5b5061036b7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561054b57600080fd5b5061055f61055a36600461333f565b611083565b60405161032e91906133cc565b34801561057857600080fd5b506103d661058736600461333f565b611149565b34801561059857600080fd5b506105f76105a7366004612f2a565b60056020526000908152604090205460ff811690610100810464ffffffffff16906601000000000000810465ffffffffffff16906c0100000000000000000000000090046001600160a01b031684565b60405161032e94939291906134e1565b34801561061357600080fd5b5061036b61070881565b34801561062957600080fd5b50610322610638366004612f2a565b6000908152600660205260409020546c0100000000000000000000000090046001600160a01b0316151590565b34801561067157600080fd5b506103d6610680366004613522565b61133e565b6103d661069336600461333f565b611354565b3480156106a457600080fd5b506106b86106b3366004613567565b61135e565b6040516001600160a01b03909116815260200161032e565b3480156106dc57600080fd5b506107246106eb366004612f2a565b600090815260056020526040902054610100810464ffffffffff16916c010000000000000000000000009091046001600160a01b031690565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161032e565b34801561075c57600080fd5b5061032261076b36600461306a565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156107a057600080fd5b5061036b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6103d66107d6366004613202565b61137d565b3480156107e757600080fd5b5061036b600081565b3480156107fc57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561083057600080fd5b5061032261083f36600461306a565b61162e565b34801561085057600080fd5b5061086461085f36600461333f565b611719565b60405161032e9190613589565b34801561087d57600080fd5b506103d661088c366004612f2a565b6118d1565b34801561089d57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156108d157600080fd5b506103d66108e0366004612f2a565b6119f3565b3480156108f157600080fd5b506103d6610900366004612f2a565b611ad5565b34801561091157600080fd5b5061036b620f424081565b6103d661092a36600461366f565b611b3d565b34801561093b57600080fd5b506103d661094a36600461333f565b611dbf565b34801561095b57600080fd5b506109ae61096a366004612f2a565b60066020526000908152604090205465ffffffffffff8082169166010000000000008104909116906c0100000000000000000000000090046001600160a01b031683565b6040805165ffffffffffff94851681529390921660208401526001600160a01b03169082015260600161032e565b3480156109e857600080fd5b5061036b6109f7366004612f2a565b611dca565b348015610a0857600080fd5b5061036b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b348015610a3c57600080fd5b506103d6610a4b36600461306a565b611de1565b348015610a5c57600080fd5b5061036b610a6b36600461304d565b60036020526000908152604090205481565b348015610a8957600080fd5b5061036b61ffff81565b348015610a9f57600080fd5b5061036b60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610aff5750610aff82611e06565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b2f81611e9d565b6001600160a01b03831660009081526003602052604081205490819003610b565750505050565b6001600160a01b038416600081815260036020526040812055610b7a908483611ea7565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610bf681611e9d565b600160008581526005602052604090205460ff166004811115610c1b57610c1b612f43565b14610c52576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260056020908152604091829020805460027fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009091166101004264ffffffffff16027fffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffff161766010000000000004365ffffffffffff160217176bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0387169081029190911790915582518681529251909287927f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e492918290030190a350505050565b600082815260208190526040902060010154610d5481611e9d565b610d5e8383611fca565b50505050565b6001600160a01b0381163314610da6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bc78282611fff565b815160208301206000610dc284611083565b9050600260008381526005602052604090205460ff166004811115610de957610de9612f43565b14610e20576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316610e5d576000828152600560205260409020546c0100000000000000000000000090046001600160a01b03169250610ebd565b6000828152600560205260409020546c0100000000000000000000000090046001600160a01b03163314610ebd576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611610f18576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905561010081015115610f925761010081015160808201516001600160a01b031660009081526003602052604081208054909190610f8c90849061376c565b90915550505b608081015160c0820151610fb06001600160a01b0383168683611ea7565b6000848152600560209081526040918290205482516001600160a01b038681168252928101859052888316936c010000000000000000000000009092049092169187917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac678910160405180910390a4505050505050565b611080816040518060a0016040528060006001600160a01b03168152602001600081526020016040518060200160405280600081525081526020016000815260200160405180602001604052806000815250815250611b3d565b50565b611135604051806101e00160405280600063ffffffff168152602001600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001606081525090565b81806020019051810190610aff91906137da565b80516020820120600061115b83611083565b9050600160008381526005602052604090205460ff16600481111561118257611182612f43565b146111b9576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205460ff161561123357806101400151421161122e576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127f565b62093a80816101400151611247919061376c565b421161127f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166004179055820151608083015161010084015160c0850151929391926112d8919061376c565b90506112ee6001600160a01b0383168483611ea7565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b61135082805190602001208233610bcc565b5050565b611080813361137d565b6000828152600160205260408120611376908361202c565b9392505050565b81516020830120600061138f84611083565b905061139c818385612038565b604080516060808201835265ffffffffffff438116835242811660208085019182526001600160a01b03808a1686880190815260008a8152600690935296909120945185549251965182166c01000000000000000000000000026bffffffffffffffffffffffff9785166601000000000000027fffffffffffffffffffffffffffffffffffffffff000000000000000000000000909416919094161791909117949094161790915582015160a083015160e084015191929091907fffffffffffffffffffffffff1111111111111111111111111111111111111112908316016114fa57610120840151156114bc576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8034146114f5576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154d565b8361012001513414611538576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154d6001600160a01b0383163385846121db565b6101c0840151511561156f5761156a838383876101c00151612257565b61157f565b341561157f5761157f83346123b6565b826001600160a01b0316866001600160a01b0316867ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c876000015188608001518960a001518a60c001518b60e001518c610120015160405161161d9695949392919063ffffffff9690961686526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b60405180910390a450505050505050565b6000600260008481526005602052604090205460ff16600481111561165557611655612f43565b1461168c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020546001600160a01b038381166c0100000000000000000000000090920416146116ef576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060009081526005602052604090205461070861010090910464ffffffffff9081164203161190565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820181905261016082015290517f5aa6ccba0000000000000000000000000000000000000000000000000000000081523090635aa6ccba906117b290859060040161390f565b600060405180830381865afa9250505080156117f057506040513d6000823e601f3d908101601f191682016040526117ed91908101906137da565b60015b6118085781806020019051810190610aff919061392d565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff16815260200182604001516001600160a01b0316815260200182606001516001600160a01b0316815260200182608001516001600160a01b031681526020018260a001516001600160a01b031681526020018260c0015181526020018260e001518152602001826101000151815260200182610120015160001415151581526020018261014001518152602001826101600151815250915050919050565b919050565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6118fb81611e9d565b600260008381526005602052604090205460ff16600481111561192057611920612f43565b14611957576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611156119b3576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560205260408082206001905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611a1d81611e9d565b612710821115611a8e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611aff81611e9d565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101611ac8565b6000816020015142611b4f91906139f9565b9050611b5c83838361247f565b6000611b7084606001518560a00151612704565b90506000806002541115611b9d57620f424060025483611b909190613a21565b611b9a9190613a38565b90505b611ba78183613a73565b91506000604051806101e001604052804663ffffffff168152602001876000015163ffffffff16815260200187602001516001600160a01b0316815260200187604001516001600160a01b0316815260200187606001516001600160a01b0316815260200187608001516001600160a01b031681526020018481526020018760c0015181526020018381526020018660600151815260200187610100015181526020016007600089602001516001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190611c8490613a86565b91905055815260200186600001516001600160a01b031681526020018581526020018660800151815250604051602001611cbe91906133cc565b60408051808303601f1901815282825280516020808301919091206000818152600583529390932080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905589015189516060808c015160808d015160c08e0151928d015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95611d72958b95909493928e9290151590613abe565b60405180910390a3807f3120e2bb59c86aca6890191a589a96af3662838efa374fbdcdf4c95bfe4a6c0e8760400151604051611dae919061390f565b60405180910390a250505050505050565b611080816000610db0565b6000818152600160205260408120610aff906128ad565b600082815260208190526040902060010154611dfc81611e9d565b610d5e8383611fff565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aff57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610aff565b61108081336128b7565b306001600160a01b03831603611ebc57505050565b80600003611ec957505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611fb6576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f46576040519150601f19603f3d011682016040523d82523d6000602084013e611f4b565b606091505b5050905080610d5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401611a85565b610bc76001600160a01b0384168383612923565b600080611fd78484612954565b90508015611376576000848152600160205260409020611ff79084612a1c565b509392505050565b60008061200c8484612a31565b90508015611376576000848152600160205260409020611ff79084612ad2565b60006113768383612ae7565b6001600160a01b038116612078576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660205260409020546c0100000000000000000000000090046001600160a01b0316156120d7576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b4663ffffffff16836020015163ffffffff1614612120576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82610140015142111561215f576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101808301516001600160a01b0316158015906121935750806001600160a01b03168361018001516001600160a01b031614155b80156121a45750826101a001514211155b15610bc7576040517f14be123200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610d5e9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b11565b600083838360405160240161226e93929190613b14565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f461e0c2100000000000000000000000000000000000000000000000000000000179052905060006122d5868334612b8d565b90508051600003612312576040517f1a95ad2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160201461234d576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f461e0c210000000000000000000000000000000000000000000000000000000061237782613b45565b146123ae576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b804710156123f2576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a85565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461243f576040519150601f19603f3d011682016040523d82523d6000602084013e612444565b606091505b5050905080610bc7576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836000015163ffffffff16036124c2576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a083015115806124d5575060c0830151155b1561250c576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208301516001600160a01b03161580612531575060408301516001600160a01b0316155b15612568576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301516001600160a01b0316158061258d575060808301516001600160a01b0316155b156125c4576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6125d06107084261376c565b836101000151101561260e576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff826080015151111561264f576040517ffbe24d4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082015115801590612682575060808301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b156126b9576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811315806126cd575082610100015181135b15610bc7576040517f352807b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016127765734821461276f576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5034610aff565b612788836001600160a01b0316612c43565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa1580156127e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128099190613b8a565b90506128206001600160a01b0384163330856121db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa15801561287f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a39190613b8a565b6113769190613a73565b6000610aff825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611350576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401611a85565b6040516001600160a01b03838116602483015260448201839052610bc791859182169063a9059cbb90606401612210565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16612a14576000838152602081815260408083206001600160a01b0386168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556129cc3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610aff565b506000610aff565b6000611376836001600160a01b038416612ce9565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615612a14576000838152602081815260408083206001600160a01b038616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610aff565b6000611376836001600160a01b038416612d30565b6000826000018281548110612afe57612afe613ba3565b9060005260206000200154905092915050565b6000612b266001600160a01b03841683612e23565b90508051600014158015612b4b575080806020019051810190612b499190613bd2565b155b15610bc7576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401611a85565b606081471015612bcb576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a85565b600080856001600160a01b03168486604051612be79190613bef565b60006040518083038185875af1925050503d8060008114612c24576040519150601f19603f3d011682016040523d82523d6000602084013e612c29565b606091505b5091509150612c39868383612e31565b9695505050505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612ca5576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b600003611080576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600183016020526040812054612a1457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aff565b60008181526001830160205260408120548015612e19576000612d54600183613a73565b8554909150600090612d6890600190613a73565b9050808214612dcd576000866000018281548110612d8857612d88613ba3565b9060005260206000200154905080876000018481548110612dab57612dab613ba3565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612dde57612dde613c0b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aff565b6000915050610aff565b606061137683836000612b8d565b606082612e4657612e4182612ea6565b611376565b8151158015612e5d57506001600160a01b0384163b155b15612e9f576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401611a85565b5080611376565b805115612eb65780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612efa57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461137657600080fd5b600060208284031215612f3c57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60058110612fa9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610aff8284612f72565b6001600160a01b038116811461108057600080fd5b80356118cc81612fbb565b60008060408385031215612fee57600080fd5b8235612ff981612fbb565b9150602083013561300981612fbb565b809150509250929050565b60008060006060848603121561302957600080fd5b8335925060208401359150604084013561304281612fbb565b809150509250925092565b60006020828403121561305f57600080fd5b813561137681612fbb565b6000806040838503121561307d57600080fd5b82359150602083013561300981612fbb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff811182821017156130e2576130e261308f565b60405290565b60405160a0810167ffffffffffffffff811182821017156130e2576130e261308f565b6040516101e0810167ffffffffffffffff811182821017156130e2576130e261308f565b604051610180810167ffffffffffffffff811182821017156130e2576130e261308f565b604051601f8201601f1916810167ffffffffffffffff8111828210171561317c5761317c61308f565b604052919050565b600067ffffffffffffffff82111561319e5761319e61308f565b50601f01601f191660200190565b600082601f8301126131bd57600080fd5b81356131d06131cb82613184565b613153565b8181528460208386010111156131e557600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561321557600080fd5b823567ffffffffffffffff81111561322c57600080fd5b613238858286016131ac565b925050602083013561300981612fbb565b63ffffffff8116811461108057600080fd5b80356118cc81613249565b801515811461108057600080fd5b80356118cc81613266565b6000610120828403121561329257600080fd5b61329a6130be565b90506132a58261325b565b81526132b360208301612fd0565b60208201526132c460408301612fd0565b60408201526132d560608301612fd0565b60608201526132e660808301612fd0565b608082015260a082013560a082015260c082013560c082015261330b60e08301613274565b60e082015261010080830135818301525092915050565b6000610120828403121561333557600080fd5b611376838361327f565b60006020828403121561335157600080fd5b813567ffffffffffffffff81111561336857600080fd5b613374848285016131ac565b949350505050565b60005b8381101561339757818101518382015260200161337f565b50506000910152565b600081518084526133b881602086016020860161337c565b601f01601f19169290920160200192915050565b602081526133e360208201835163ffffffff169052565b600060208301516133fc604084018263ffffffff169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a06134ba818501836001600160a01b03169052565b8401516101c0848101919091528401516101e08085015290506133746102008401826133a0565b608081016134ef8287612f72565b64ffffffffff8516602083015265ffffffffffff841660408301526001600160a01b038316606083015295945050505050565b6000806040838503121561353557600080fd5b823567ffffffffffffffff81111561354c57600080fd5b613558858286016131ac565b95602094909401359450505050565b6000806040838503121561357a57600080fd5b50508035926020909101359150565b815163ffffffff168152610180810160208301516135af602084018263ffffffff169052565b5060408301516135ca60408401826001600160a01b03169052565b5060608301516135e560608401826001600160a01b03169052565b50608083015161360060808401826001600160a01b03169052565b5060a083015161361b60a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516136508285018215159052565b5050610140838101519083015261016092830151929091019190915290565b600080610140838503121561368357600080fd5b61368d848461327f565b915061012083013567ffffffffffffffff808211156136ab57600080fd5b9084019060a082870312156136bf57600080fd5b6136c76130e8565b82356136d281612fbb565b8152602083810135908201526040830135828111156136f057600080fd5b6136fc888286016131ac565b6040830152506060830135606082015260808301358281111561371e57600080fd5b61372a888286016131ac565b6080830152508093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610aff57610aff61373d565b80516118cc81613249565b80516118cc81612fbb565b600082601f8301126137a657600080fd5b81516137b46131cb82613184565b8181528460208386010111156137c957600080fd5b61337482602083016020870161337c565b6000602082840312156137ec57600080fd5b815167ffffffffffffffff8082111561380457600080fd5b908301906101e0828603121561381957600080fd5b61382161310b565b61382a8361377f565b81526138386020840161377f565b60208201526138496040840161378a565b604082015261385a6060840161378a565b606082015261386b6080840161378a565b608082015261387c60a0840161378a565b60a082015260c0838101519082015260e0808401519082015261010080840151908201526101208084015190820152610140808401519082015261016080840151908201526101806138cf81850161378a565b908201526101a083810151908201526101c080840151838111156138f257600080fd5b6138fe88828701613795565b918301919091525095945050505050565b60208152600061137660208301846133a0565b80516118cc81613266565b6000610180828403121561394057600080fd5b61394861312f565b6139518361377f565b815261395f6020840161377f565b60208201526139706040840161378a565b60408201526139816060840161378a565b60608201526139926080840161378a565b60808201526139a360a0840161378a565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206139d6818501613922565b908201526101408381015190820152610160928301519281019290925250919050565b8082018281126000831280158216821582161715613a1957613a1961373d565b505092915050565b8082028115828204841417610aff57610aff61373d565b600082613a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610aff57610aff61373d565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613ab757613ab761373d565b5060010190565b60e081526000613ad160e083018a6133a0565b63ffffffff989098166020830152506001600160a01b039586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b6001600160a01b0384168152826020820152606060408201526000613b3c60608301846133a0565b95945050505050565b80516020808301519190811015613b84577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b600060208284031215613b9c57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613be457600080fd5b815161137681613266565b60008251613c0181846020870161337c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220a3680a17873f4c46b682e496f075c28aef799dbfefc67679607c7ecbffed72b464736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"64760:19813:0:-:0;;;65906:1;65873:34;;66011:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;66045:6;63675:38;52847:4;66045:6;63675:10;:38::i;:::-;-1:-1:-1;;66077:12:0::1;66063:26;::::0;-1:-1:-1;64760:19813:0;;62160:257;62246:4;;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62318:69;62403:7;-1:-1:-1;62160:257:0;;;;;:::o;56794:316::-;56871:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;-1:-1:-1;;;;;56930:29:0;;;;;;;;;:36;;-1:-1:-1;;56930:36:0;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;-1:-1:-1;;;;;56985:40:0;57003:7;-1:-1:-1;;;;;56985:40:0;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;-1:-1:-1;;;;;32931:23:0;;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;14:290:1;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:1;;214:42;;204:70;;270:1;267;260:12;14:290;64760:19813:0;;;;;;;;;;;;;;;;;;","srcMapRuntime":"64760:19813:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60820:212;;;;;;;;;;-1:-1:-1;60820:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;60820:212:0;;;;;;;;63050:60;;;;;;;;;;;;63087:23;63050:60;;;;;785:25:1;;;773:2;758:18;63050:60:0;639:177:1;78381:150:0;;;;;;;;;;-1:-1:-1;78381:150:0;;;;;:::i;:::-;78449:19;78487:30;;;:15;:30;;;;;:37;;;;78381:150;;;;;;;;:::i;64022:359::-;;;;;;;;;;-1:-1:-1;64022:359:0;;;;;:::i;:::-;;:::i;:::-;;63232:45;;;;;;;;;;;;63271:6;63232:45;;76275:648;;;;;;;;;;-1:-1:-1;76275:648:0;;;;;:::i;:::-;;:::i;65110:45::-;;;;;;;;;;;;65149:6;65110:45;;54425:120;;;;;;;;;;-1:-1:-1;54425:120:0;;;;;:::i;:::-;54490:7;54516:12;;;;;;;;;;:22;;;;54425:120;65722:47;;;;;;;;;;-1:-1:-1;65722:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;54841:136;;;;;;;;;;-1:-1:-1;54841:136:0;;;;;:::i;:::-;;:::i;55943:245::-;;;;;;;;;;-1:-1:-1;55943:245:0;;;;;:::i;:::-;;:::i;76961:1414::-;;;;;;;;;;-1:-1:-1;76961:1414:0;;;;;:::i;:::-;;:::i;66134:369::-;;;;;;:::i;:::-;;:::i;63394:30::-;;;;;;;;;;;;;;;;62978:66;;;;;;;;;;;;63018:26;62978:66;;79059:169;;;;;;;;;;-1:-1:-1;79059:169:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67821:1169::-;;;;;;;;;;-1:-1:-1;67821:1169:0;;;;;:::i;:::-;;:::i;65482:58::-;;;;;;;;;;-1:-1:-1;65482:58:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;65482:58:0;;;;;;;;;;;;;:::i;65242:56::-;;;;;;;;;;;;65288:10;65242:56;;78820:199;;;;;;;;;;-1:-1:-1;78820:199:0;;;;;:::i;:::-;78886:4;78957:33;;;:18;:33;;;;;:41;;;;-1:-1:-1;;;;;78957:41:0;:55;;;78820:199;66696:170;;;;;;;;;;-1:-1:-1;66696:170:0;;;;;:::i;:::-;;:::i;66541:117::-;;;;;;:::i;:::-;;:::i;61617:142::-;;;;;;;;;;-1:-1:-1;61617:142:0;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;12205:55:1;;;12187:74;;12175:2;12160:18;61617:142:0;12041:226:1;78537:243:0;;;;;;;;;;-1:-1:-1;78537:243:0;;;;;:::i;:::-;78603:16;78660:30;;;:15;:30;;;;;:50;;;;;;;78730:43;;;;-1:-1:-1;;;;;78730:43:0;;78537:243;;;;;12474:26:1;12462:39;;;12444:58;;-1:-1:-1;;;;;12538:55:1;;;12533:2;12518:18;;12511:83;12417:18;78537:243:0;12272:328:1;53469:136:0;;;;;;;;;;-1:-1:-1;53469:136:0;;;;;:::i;:::-;53546:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;;;;53469:136;62908:64;;;;;;;;;;;;62947:25;62908:64;;73354:2881;;;;;;:::i;:::-;;:::i;52802:49::-;;;;;;;;;;-1:-1:-1;52802:49:0;52847:4;52802:49;;65968:36;;;;;;;;;;;;;;;69028:392;;;;;;;;;;-1:-1:-1;69028:392:0;;;;;:::i;:::-;;:::i;69755:1121::-;;;;;;;;;;-1:-1:-1;69755:1121:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67048:735::-;;;;;;;;;;-1:-1:-1;67048:735:0;;;;;:::i;:::-;;:::i;65873:34::-;;;;;;;;;;;;;;;63726:290;;;;;;;;;;-1:-1:-1;63726:290:0;;;;;:::i;:::-;;:::i;64387:264::-;;;;;;;;;;-1:-1:-1;64387:264:0;;;;;:::i;:::-;;:::i;63189:37::-;;;;;;;;;;;;63223:3;63189:37;;70916:2398;;;;;;:::i;:::-;;:::i;66906:104::-;;;;;;;;;;-1:-1:-1;66906:104:0;;;;;:::i;:::-;;:::i;65597:57::-;;;;;;;;;;-1:-1:-1;65597:57:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;65597:57:0;;;;;;;15543:14:1;15584:15;;;15566:34;;15636:15;;;;15631:2;15616:18;;15609:43;-1:-1:-1;;;;;15688:55:1;15668:18;;;15661:83;15521:2;15506:18;65597:57:0;15335:415:1;61927:131:0;;;;;;;;;;-1:-1:-1;61927:131:0;;;;;:::i;:::-;;:::i;63116:66::-;;;;;;;;;;;;63156:26;63116:66;;55257:138;;;;;;;;;;-1:-1:-1;55257:138:0;;;;;:::i;:::-;;:::i;63480:47::-;;;;;;;;;;-1:-1:-1;63480:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;65359:60;;;;;;;;;;;;65408:11;65359:60;;63601:29;;;;;;;;;;;;;;;;60820:212;60905:4;60928:57;;;60943:42;60928:57;;:97;;;60989:36;61013:11;60989:23;:36::i;:::-;60921:104;60820:212;-1:-1:-1;;60820:212:0:o;64022:359::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;-1:-1:-1;;;;;64146:19:0;::::1;64126:17;64146:19:::0;;;:12:::1;:19;::::0;;;;;;64179:14;;;64175:27:::1;;64195:7;64022:359:::0;;;:::o;64175:27::-:1;-1:-1:-1::0;;;;;64243:19:0;::::1;64265:1;64243:19:::0;;;:12:::1;:19;::::0;;;;:23;64276:45:::1;::::0;64300:9;64311;64276:23:::1;:45::i;:::-;64336:38;::::0;;-1:-1:-1;;;;;16036:15:1;;;16018:34;;16088:15;;16083:2;16068:18;;16061:43;16120:18;;;16113:34;;;64336:38:0::1;::::0;15945:2:1;15930:18;64336:38:0::1;;;;;;;64116:265;53105:1;64022:359:::0;;;:::o;76275:648::-;62947:25;53079:16;53090:4;53079:10;:16::i;:::-;76491:22:::1;76450:30;::::0;;;:15:::1;:30;::::0;;;;:37;::::1;;:63;::::0;::::1;;;;;;:::i;:::-;;76446:93;;76522:17;;;;;;;;;;;;;;76446:93;76549:30;::::0;;;:15:::1;:30;::::0;;;;;;;;:67;;76589:27:::1;76712:70:::0;;;;76626:76:::1;76686:15;76626:76;;;76712:70:::0;;;;76769:12:::1;76712:70;;;::::0;;76792:53;::::1;::::0;-1:-1:-1;;;;;76792:53:0;::::1;::::0;;::::1;::::0;;;::::1;::::0;;;76861:55;;785:25:1;;;76861:55:0;;76792:53;;76549:30;;76861:55:::1;::::0;;;;;;;::::1;76275:648:::0;;;;:::o;54841:136::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;54945:25:::1;54956:4;54962:7;54945:10;:25::i;:::-;;54841:136:::0;;;:::o;55943:245::-;-1:-1:-1;;;;;56036:34:0;;23368:10;56036:34;56032:102;;56093:30;;;;;;;;;;;;;;56032:102;56144:37;56156:4;56162:18;56144:11;:37::i;76961:1414::-;77051:18;;;;;;77027:21;77120:31;77061:7;77120:22;:31::i;:::-;77079:72;-1:-1:-1;77277:27:0;77236:30;;;;:15;:30;;;;;:37;;;:68;;;;;;;;:::i;:::-;;77232:98;;77313:17;;;;;;;;;;;;;;77232:98;-1:-1:-1;;;;;77424:16:0;;77420:213;;77461:30;;;;:15;:30;;;;;:43;;;;-1:-1:-1;;;;;77461:43:0;;-1:-1:-1;77420:213:0;;;77525:30;;;;:15;:30;;;;;:43;;;;-1:-1:-1;;;;;77525:43:0;77572:10;77525:57;77521:112;;77605:17;;;;;;;;;;;;;;77521:112;77658:30;;;;:15;:30;;;;;:50;65004:10;;77658:50;;;;;;;81985:15;81978:45;81970:53;77647:80;77643:142;;77750:24;;;;;;;;;;;;;;77643:142;77795:30;;;;:15;:30;;;;;:68;;;;77835:28;77795:68;;;77938:27;;;;:31;77934:105;;78012:27;;;;77984:23;;;;-1:-1:-1;;;;;77971:37:0;;;;;:12;:37;;;;;:68;;:37;;;:68;;78012:27;;77971:68;:::i;:::-;;;;-1:-1:-1;;77934:105:0;78134:23;;;;78184:24;;;;78218:35;-1:-1:-1;;;;;78218:23:0;;78242:2;78184:24;78218:23;:35::i;:::-;78305:30;;;;:15;:30;;;;;;;;;:43;78269:99;;-1:-1:-1;;;;;16669:55:1;;;16651:74;;16741:18;;;16734:34;;;78269:99:0;;;;78305:43;;;;;;;;:30;;78269:99;;16624:18:1;78269:99:0;;;;;;;77017:1358;;;;76961:1414;;:::o;66134:369::-;66205:291;66234:6;66264:221;;;;;;;;66319:1;-1:-1:-1;;;;;66264:221:0;;;;;66364:1;66264:221;;;;66392:9;;;;;;;;;;;;66264:221;;;;66430:1;66264:221;;;;66461:9;;;;;;;;;;;;66264:221;;;66205:6;:291::i;:::-;66134:369;:::o;79059:169::-;79134:26;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;79134:26:0;79190:7;79179:42;;;;;;;;;;;;:::i;67821:1169::-;67902:18;;;;;;67878:21;67972:31;67912:7;67972:22;:31::i;:::-;67931:72;-1:-1:-1;68059:22:0;68018:30;;;;:15;:30;;;;;:37;;;:63;;;;;;;;:::i;:::-;;68014:93;;68090:17;;;;;;;;;;;;;;68014:93;68145:10;53546:4;53569:29;;;:12;;:29;:12;:29;;;;;68118:382;;;68253:11;:20;;;68234:15;:39;68230:73;;68282:21;;;;;;;;;;;;;;68230:73;68118:382;;;65149:6;68424:11;:20;;;:35;;;;:::i;:::-;68405:15;:54;68401:88;;68468:21;;;;;;;;;;;;;;68401:88;68566:30;;;;:15;:30;;;;;;:61;;;;68606:21;68566:61;;;68713:24;;;68763:23;;;;68840:27;;;;68813:24;;;;68713;;68763:23;;68813:54;;68840:27;68813:54;:::i;:::-;68796:71;-1:-1:-1;68877:35:0;-1:-1:-1;;;;;68877:23:0;;68901:2;68796:71;68877:23;:35::i;:::-;68928:55;;;-1:-1:-1;;;;;16669:55:1;;;16651:74;;16756:2;16741:18;;16734:34;;;68928:55:0;;;68950:13;;68928:55;;16624:18:1;68928:55:0;;;;;;;67868:1122;;;;;67821:1169;:::o;66696:170::-;66772:87;66804:7;66794:18;;;;;;66826:10;66847;66772:5;:87::i;:::-;66696:170;;:::o;66541:117::-;66605:46;66621:7;66639:10;66605:5;:46::i;61617:142::-;61698:7;61724:18;;;:12;:18;;;;;:28;;61746:5;61724:21;:28::i;:::-;61717:35;61617:142;-1:-1:-1;;;61617:142:0:o;73354:2881::-;73457:18;;;;;;73433:21;73526:31;73467:7;73526:22;:31::i;:::-;73485:72;;73567:57;73588:11;73601:13;73616:7;73567:20;:57::i;:::-;73728:107;;;;;;;;;;73761:12;73728:107;;;;73799:15;73728:107;;;;;;;;;-1:-1:-1;;;;;73728:107:0;;;;;;;;;-1:-1:-1;73680:33:0;;;:18;:33;;;;;;;:155;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;73958:25;;;74009:21;;;;74057:22;;;;73958:25;;74009:21;;74057:22;74294:38;;;;;74290:719;;74409:21;;;;:26;74405:73;;74444:34;;;;;;;;;;;;;;74405:73;74566:6;74553:9;:19;74549:51;;74581:19;;;;;;;;;;;;;;74549:51;74290:719;;;74720:11;:21;;;74707:9;:34;74703:66;;74750:19;;;;;;;;;;;;;;74703:66;74944:54;-1:-1:-1;;;;;74944:30:0;;74975:10;74987:2;74991:6;74944:30;:54::i;:::-;75023:22;;;;:29;:34;75019:776;;75375:104;75409:2;75420:5;75435:6;75455:11;:22;;;75375:21;:104::i;:::-;75019:776;;;75500:9;:14;75496:299;;75743:41;75769:2;75774:9;75743:17;:41::i;:::-;75914:2;-1:-1:-1;;;;;75810:418:0;75889:7;-1:-1:-1;;;;;75810:418:0;75853:13;75810:418;75945:11;:25;;;75997:11;:23;;;76045:11;:21;;;76094:11;:24;;;76144:11;:22;;;76196:11;:21;;;75810:418;;;;;;;;;;19501:10:1;19489:23;;;;19471:42;;-1:-1:-1;;;;;19610:15:1;;;19605:2;19590:18;;19583:43;19662:15;;;;19657:2;19642:18;;19635:43;19709:2;19694:18;;19687:34;19752:3;19737:19;;19730:35;;;;19796:3;19781:19;;19774:35;19458:3;19443:19;;19186:629;75810:418:0;;;;;;;;73423:2812;;;;;73354:2881;;:::o;69028:392::-;69109:4;69170:27;69129:30;;;;:15;:30;;;;;:37;;;:68;;;;;;;;:::i;:::-;;69125:98;;69206:17;;;;;;;;;;;;;;69125:98;69237:30;;;;:15;:30;;;;;:43;-1:-1:-1;;;;;69237:54:0;;;:43;;;;;:54;69233:84;;69300:17;;;;;;;;;;;;;;69233:84;-1:-1:-1;;69345:30:0;;;;:15;:30;;;;;:50;65004:10;69345:50;;;;;;;;81985:15;81978:45;81970:53;69334:79;;69028:392::o;69755:1121::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;69956:36:0;;;;;:4;;:27;;:36;;69984:7;;69956:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;69956:36:0;;;;;;;;;;;;:::i;:::-;;;69952:918;;70830:7;70819:40;;;;;;;;;;;;:::i;69952:918::-;70146:597;;;;;;;;70197:4;:18;;;70146:597;;;;;;70246:4;:16;;;70146:597;;;;;;70294:4;:17;;;-1:-1:-1;;;;;70146:597:0;;;;;70344:4;:18;;;-1:-1:-1;;;;;70146:597:0;;;;;70393:4;:16;;;-1:-1:-1;;;;;70146:597:0;;;;;70438:4;:14;;;-1:-1:-1;;;;;70146:597:0;;;;;70484:4;:17;;;70146:597;;;;70531:4;:15;;;70146:597;;;;70581:4;:20;;;70146:597;;;;70633:4;:14;;;70651:1;70633:19;;70146:597;;;;;;70680:4;:13;;;70146:597;;;;70718:4;:10;;;70146:597;;;70139:604;;;69755:1121;;;:::o;69952:918::-;69755:1121;;;:::o;67048:735::-;63087:23;53079:16;53090:4;53079:10;:16::i;:::-;67173:27:::1;67132:30;::::0;;;:15:::1;:30;::::0;;;;:37;::::1;;:68;::::0;::::1;;;;;;:::i;:::-;;67128:98;;67209:17;;;;;;;;;;;;;;67128:98;67251:30;::::0;;;:15:::1;:30;::::0;;;;:50;65004:10:::1;::::0;67251:50:::1;::::0;::::1;;::::0;;::::1;81985:15:::0;81978:45;81970:53;67240:79:::1;67236:138;;;67342:21;;;;;;;;;;;;;;67236:138;67461:30;::::0;;;:15:::1;:30;::::0;;;;;67501:22:::1;67663:51:::0;;67730:46;67765:10:::1;::::0;67461:30;;67730:46:::1;::::0;67461:30;67730:46:::1;67048:735:::0;;:::o;63726:290::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;63271:6:::1;63825:10;:26;;63817:55;;;::::0;::::1;::::0;;21574:2:1;63817:55:0::1;::::0;::::1;21556:21:1::0;21613:2;21593:18;;;21586:30;21652:18;21632;;;21625:46;21688:18;;63817:55:0::1;;;;;;;;;63903:15;::::0;;63928:28;;;;63971:38:::1;::::0;;21891:25:1;;;21947:2;21932:18;;21925:34;;;63971:38:0::1;::::0;21864:18:1;63971:38:0::1;;;;;;;;63807:209;63726:290:::0;;:::o;64387:264::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;64512:14:::1;::::0;;64536:34;;;;64585:59:::1;::::0;;21891:25:1;;;21947:2;21932:18;;21925:34;;;64585:59:0::1;::::0;21864:18:1;64585:59:0::1;21717:248:1::0;70916:2398:0;71017:25;71071:8;:32;;;71052:15;71045:58;;;;:::i;:::-;71017:86;;71113:59;71135:6;71143:8;71153:18;71113:21;:59::i;:::-;71308:20;71331:51;71342:6;:18;;;71362:6;:19;;;71331:10;:51::i;:::-;71308:74;;71450:23;71505:1;71487:15;;:19;71483:85;;;63223:3;71542:15;;71527:12;:30;;;;:::i;:::-;71526:42;;;;:::i;:::-;71508:60;;71483:85;71578:31;71594:15;71578:31;;:::i;:::-;;;71722:20;71769:924;;;;;;;;71829:13;71769:924;;;;;;71874:6;:17;;;71769:924;;;;;;71923:6;:13;;;-1:-1:-1;;;;;71769:924:0;;;;;71969:6;:9;;;-1:-1:-1;;;;;71769:924:0;;;;;72009:6;:18;;;-1:-1:-1;;;;;71769:924:0;;;;;72056:6;:16;;;-1:-1:-1;;;;;71769:924:0;;;;;72104:12;71769:924;;;;72146:6;:17;;;71769:924;;;;72198:15;71769:924;;;;72242:8;:18;;;71769:924;;;;72288:6;:15;;;71769:924;;;;72328:12;:27;72341:6;:13;;;-1:-1:-1;;;;;72328:27:0;-1:-1:-1;;;;;72328:27:0;;;;;;;;;;;;;:29;;;;;;;;;:::i;:::-;;;;;71769:924;;;;72430:8;:21;;;-1:-1:-1;;;;;71769:924:0;;;;;72610:18;71769:924;;;;72659:8;:19;;;71769:924;;;71745:958;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;71745:958:0;;;;;;72737:18;;71745:958;72737:18;;;;;;;72713:21;72765:30;;;:15;:30;;;;;;:62;;;;72805:22;72765:62;;;72923:13;;;72993:17;;73037:18;;;;;73080:16;;;;73162:17;;;;73207:18;;;;71745:958;;-1:-1:-1;72737:18:0;;-1:-1:-1;;;;;72843:398:0;;;;72737:18;;72843:398;;;;71745:958;;72993:17;;73037:18;73080:16;73124:12;;73207:23;;;;72843:398;:::i;:::-;;;;;;;;73275:13;73256:51;73290:8;:16;;;73256:51;;;;;;:::i;:::-;;;;;;;;71007:2307;;;;;70916:2398;;:::o;66906:104::-;66962:41;66978:7;66999:1;66962:5;:41::i;61927:131::-;61998:7;62024:18;;;:12;:18;;;;;:27;;:25;:27::i;55257:138::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;55362:26:::1;55374:4;55380:7;55362:11;:26::i;53180:202::-:0;53265:4;53288:47;;;53303:32;53288:47;;:87;;-1:-1:-1;45095:25:0;45080:40;;;;53339:36;44981:146;53814:103;53880:30;53891:4;23368:10;53880;:30::i;58092:653::-;58267:4;-1:-1:-1;;;;;58253:19:0;;;58249:32;;58092:653;;;:::o;58249:32::-;58353:5;58362:1;58353:10;58349:23;;58092:653;;;:::o;58349:23::-;58385:20;-1:-1:-1;;;;;58385:20:0;;;58381:358;;58565:12;58582:2;-1:-1:-1;;;;;58582:7:0;58597:5;58582:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;58564:43;;;58629:7;58621:39;;;;;;;24145:2:1;58621:39:0;;;24127:21:1;24184:2;24164:18;;;24157:30;24223:21;24203:18;;;24196:49;24262:18;;58621:39:0;23943:343:1;58381:358:0;58691:37;-1:-1:-1;;;;;58691:26:0;;58718:2;58722:5;58691:26;:37::i;62160:257::-;62246:4;62262:12;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62403:7;62160:257;-1:-1:-1;;;62160:257:0:o;62520:262::-;62607:4;62623:12;62638:32;62656:4;62662:7;62638:17;:32::i;:::-;62623:47;;62684:7;62680:72;;;62707:18;;;;:12;:18;;;;;:34;;62733:7;62707:25;:34::i;34071:156::-;34145:7;34195:22;34199:3;34211:5;34195:3;:22::i;83620:951::-;-1:-1:-1;;;;;83808:21:0;;83804:47;;83838:13;;;;;;;;;;;;;;83804:47;78886:4;78957:33;;;:18;:33;;;;;:41;;;;-1:-1:-1;;;;;78957:41:0;:55;83922:60;;83962:20;;;;;;;;;;;;;;83922:60;84030:13;83996:48;;:11;:23;;;:48;;;83992:77;;84053:16;;;;;;;;;;;;;;83992:77;84151:11;:20;;;84133:15;:38;84129:69;;;84180:18;;;;;;;;;;;;;;84129:69;84328:30;;;;-1:-1:-1;;;;;84328:44:0;;;;;:101;;;84422:7;-1:-1:-1;;;;;84388:41:0;:11;:30;;;-1:-1:-1;;;;;84388:41:0;;;84328:101;:166;;;;;84464:11;:30;;;84445:15;:49;;84328:166;84311:254;;;84526:28;;;;;;;;;;;;;;46696:188;46823:53;;-1:-1:-1;;;;;16036:15:1;;;46823:53:0;;;16018:34:1;16088:15;;;16068:18;;;16061:43;16120:18;;;16113:34;;;46796:81:0;;46816:5;;46838:18;;;;;15930::1;;46823:53:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;46796:19;:81::i;80387:999::-;80562:21;80663:5;80670:6;80678:10;80598:92;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;80598:92:0;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;80797:84:0;80836:9;80598:92;80870:9;80797:29;:84::i;:::-;80771:110;;80947:10;:17;80968:1;80947:22;80943:59;;80978:24;;;;;;;;;;;;;;80943:59;81081:10;:17;81102:2;81081:23;81077:67;;81113:31;;;;;;;;;;;;;;81077:67;81258:56;81227:19;81235:10;81227:19;:::i;:::-;:88;81223:157;;81338:31;;;;;;;;;;;;;;81223:157;80552:834;;80387:999;;;;:::o;17900:331::-;18009:6;17985:21;:30;17981:109;;;18038:41;;;;;18073:4;18038:41;;;12187:74:1;12160:18;;18038:41:0;12041:226:1;17981:109:0;18101:12;18119:9;-1:-1:-1;;;;;18119:14:0;18141:6;18119:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18100:52;;;18167:7;18162:63;;18197:17;;;;;;;;;;;;;;82365:1176;82618:13;82597:6;:17;;;:34;;;82593:63;;82640:16;;;;;;;;;;;;;;82593:63;82670:19;;;;:24;;:50;;-1:-1:-1;82698:17:0;;;;:22;82670:50;82666:80;;;82729:17;;;;;;;;;;;;;;82666:80;82760:13;;;;-1:-1:-1;;;;;82760:27:0;;;:54;;-1:-1:-1;82791:9:0;;;;-1:-1:-1;;;;;82791:23:0;;82760:54;82756:80;;;82823:13;;;;;;;;;;;;;;82756:80;82850:18;;;;-1:-1:-1;;;;;82850:32:0;;;:66;;-1:-1:-1;82886:16:0;;;;-1:-1:-1;;;;;82886:30:0;;82850:66;82846:92;;;82925:13;;;;;;;;;;;;;;82846:92;82970:37;65288:10;82970:15;:37;:::i;:::-;82952:6;:15;;;:55;82948:86;;;83016:18;;;;;;;;;;;;;;82948:86;65408:11;83075:8;:19;;;:26;:51;83071:90;;;83135:26;;;;;;;;;;;;;;83071:90;83175:18;;;;:23;;;;:76;;-1:-1:-1;83202:16:0;;;;-1:-1:-1;;;;;83202:49:0;57809:42;83202:49;83175:76;83171:148;;;83274:34;;;;;;;;;;;;;;83171:148;83424:1;83402:18;:23;;:71;;;;83457:6;:15;;;83429:18;:44;83402:71;83398:137;;;83496:28;;;;;;;;;;;;;;79306:923;79375:20;79411:38;-1:-1:-1;;;;;79411:38:0;;;79407:816;;79563:9;79553:6;:19;79549:51;;79581:19;;;;;;;;;;;;;;79549:51;-1:-1:-1;79629:9:0;79407:816;;;79669:24;:5;-1:-1:-1;;;;;79669:22:0;;:24::i;:::-;79774:38;;;;;79806:4;79774:38;;;12187:74:1;-1:-1:-1;;;;;79774:23:0;;;;;12160:18:1;;79774:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;79759:53;-1:-1:-1;79958:65:0;-1:-1:-1;;;;;79958:30:0;;79989:10;80009:4;80016:6;79958:30;:65::i;:::-;80159:38;;;;;80191:4;80159:38;;;12187:74:1;80200:12:0;;-1:-1:-1;;;;;80159:23:0;;;;;12160:18:1;;80159:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:53;;;;:::i;33614:115::-;33677:7;33703:19;33711:3;29053:18;;28971:107;54047:197;53546:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;54130:108;;54180:47;;;;;-1:-1:-1;;;;;16669:55:1;;54180:47:0;;;16651:74:1;16741:18;;;16734:34;;;16624:18;;54180:47:0;16477:297:1;46297:160:0;46406:43;;-1:-1:-1;;;;;16669:55:1;;;46406:43:0;;;16651:74:1;16741:18;;;16734:34;;;46379:71:0;;46399:5;;46421:14;;;;;16624:18:1;;46406:43:0;16477:297:1;56794:316:0;56871:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;-1:-1:-1;;;;;56930:29:0;;;;;;;;;:36;;;;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;-1:-1:-1;;;;;56985:40:0;57003:7;-1:-1:-1;;;;;56985:40:0;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;-1:-1:-1;;;;;32931:23:0;;32906:4;:50::i;57345:317::-;57423:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;57439:217;;;57513:5;57481:12;;;;;;;;;;;-1:-1:-1;;;;;57481:29:0;;;;;;;;;;:37;;;;;;57537:40;23368:10;;57481:12;;57537:40;;57513:5;57537:40;-1:-1:-1;57598:4:0;57591:11;;33131:156;33204:4;33227:53;33235:3;-1:-1:-1;;;;;33255:23:0;;33227:7;:53::i;29420:118::-;29487:7;29513:3;:11;;29525:5;29513:18;;;;;;;;:::i;:::-;;;;;;;;;29506:25;;29420:118;;;;:::o;49053:629::-;49472:23;49498:33;-1:-1:-1;;;;;49498:27:0;;49526:4;49498:27;:33::i;:::-;49472:59;;49545:10;:17;49566:1;49545:22;;:57;;;;;49583:10;49572:30;;;;;;;;;;;;:::i;:::-;49571:31;49545:57;49541:135;;;49625:40;;;;;-1:-1:-1;;;;;12205:55:1;;49625:40:0;;;12187:74:1;12160:18;;49625:40:0;12041:226:1;19549:392:0;19648:12;19700:5;19676:21;:29;19672:108;;;19728:41;;;;;19763:4;19728:41;;;12187:74:1;12160:18;;19728:41:0;12041:226:1;19672:108:0;19790:12;19804:23;19831:6;-1:-1:-1;;;;;19831:11:0;19850:5;19857:4;19831:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19789:73;;;;19879:55;19906:6;19914:7;19923:10;19879:26;:55::i;:::-;19872:62;19549:392;-1:-1:-1;;;;;;19549:392:0:o;59909:344::-;60076:38;-1:-1:-1;;;;;60076:38:0;;;60072:69;;60123:18;;;;;;;;;;;;;;60072:69;60197:5;-1:-1:-1;;;;;60197:17:0;;60218:1;60197:22;60193:53;;60228:18;;;;;;;;;;;;;;26738:406;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;27312:1368;27378:4;27507:21;;;:14;;;:21;;;;;;27543:13;;27539:1135;;27910:18;27931:12;27942:1;27931:8;:12;:::i;:::-;27977:18;;27910:33;;-1:-1:-1;27957:17:0;;27977:22;;27998:1;;27977:22;:::i;:::-;27957:42;;28032:9;28018:10;:23;28014:378;;28061:17;28081:3;:11;;28093:9;28081:22;;;;;;;;:::i;:::-;;;;;;;;;28061:42;;28228:9;28202:3;:11;;28214:10;28202:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;28341:25;;;:14;;;:25;;;;;:36;;;28014:378;28470:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;28573:3;:14;;:21;28588:5;28573:21;;;;;;;;;;;28566:28;;;28616:4;28609:11;;;;;;;27539:1135;28658:5;28651:12;;;;;19074:151;19149:12;19180:38;19202:6;19210:4;19216:1;19180:21;:38::i;20994:582::-;21138:12;21167:7;21162:408;;21190:19;21198:10;21190:7;:19::i;:::-;21162:408;;;21414:17;;:22;:49;;;;-1:-1:-1;;;;;;21440:18:0;;;:23;21414:49;21410:119;;;21490:24;;;;;-1:-1:-1;;;;;12205:55:1;;21490:24:0;;;12187:74:1;12160:18;;21490:24:0;12041:226:1;21410:119:0;-1:-1:-1;21549:10:0;21542:17;;22112:516;22243:17;;:21;22239:383;;22471:10;22465:17;22527:15;22514:10;22510:2;22506:19;22499:44;22239:383;22594:17;;;;;;;;;;;;;;14:332:1;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;180:9;167:23;230:66;223:5;219:78;212:5;209:89;199:117;;312:1;309;302:12;821:180;880:6;933:2;921:9;912:7;908:23;904:32;901:52;;;949:1;946;939:12;901:52;-1:-1:-1;972:23:1;;821:180;-1:-1:-1;821:180:1:o;1006:184::-;1058:77;1055:1;1048:88;1155:4;1152:1;1145:15;1179:4;1176:1;1169:15;1195:297;1279:1;1272:5;1269:12;1259:200;;1315:77;1312:1;1305:88;1416:4;1413:1;1406:15;1444:4;1441:1;1434:15;1259:200;1468:18;;1195:297::o;1497:214::-;1646:2;1631:18;;1658:47;1635:9;1687:6;1658:47;:::i;1716:154::-;-1:-1:-1;;;;;1795:5:1;1791:54;1784:5;1781:65;1771:93;;1860:1;1857;1850:12;1875:134;1943:20;;1972:31;1943:20;1972:31;:::i;2014:388::-;2082:6;2090;2143:2;2131:9;2122:7;2118:23;2114:32;2111:52;;;2159:1;2156;2149:12;2111:52;2198:9;2185:23;2217:31;2242:5;2217:31;:::i;:::-;2267:5;-1:-1:-1;2324:2:1;2309:18;;2296:32;2337:33;2296:32;2337:33;:::i;:::-;2389:7;2379:17;;;2014:388;;;;;:::o;2589:383::-;2666:6;2674;2682;2735:2;2723:9;2714:7;2710:23;2706:32;2703:52;;;2751:1;2748;2741:12;2703:52;2787:9;2774:23;2764:33;;2844:2;2833:9;2829:18;2816:32;2806:42;;2898:2;2887:9;2883:18;2870:32;2911:31;2936:5;2911:31;:::i;:::-;2961:5;2951:15;;;2589:383;;;;;:::o;2977:247::-;3036:6;3089:2;3077:9;3068:7;3064:23;3060:32;3057:52;;;3105:1;3102;3095:12;3057:52;3144:9;3131:23;3163:31;3188:5;3163:31;:::i;3229:315::-;3297:6;3305;3358:2;3346:9;3337:7;3333:23;3329:32;3326:52;;;3374:1;3371;3364:12;3326:52;3410:9;3397:23;3387:33;;3470:2;3459:9;3455:18;3442:32;3483:31;3508:5;3483:31;:::i;3549:184::-;3601:77;3598:1;3591:88;3698:4;3695:1;3688:15;3722:4;3719:1;3712:15;3738:255;3810:2;3804:9;3852:6;3840:19;;3889:18;3874:34;;3910:22;;;3871:62;3868:88;;;3936:18;;:::i;:::-;3972:2;3965:22;3738:255;:::o;3998:253::-;4070:2;4064:9;4112:4;4100:17;;4147:18;4132:34;;4168:22;;;4129:62;4126:88;;;4194:18;;:::i;4256:255::-;4328:2;4322:9;4370:6;4358:19;;4407:18;4392:34;;4428:22;;;4389:62;4386:88;;;4454:18;;:::i;4516:252::-;4588:2;4582:9;4630:3;4618:16;;4664:18;4649:34;;4685:22;;;4646:62;4643:88;;;4711:18;;:::i;4773:334::-;4844:2;4838:9;4900:2;4890:13;;-1:-1:-1;;4886:86:1;4874:99;;5003:18;4988:34;;5024:22;;;4985:62;4982:88;;;5050:18;;:::i;:::-;5086:2;5079:22;4773:334;;-1:-1:-1;4773:334:1:o;5112:245::-;5160:4;5193:18;5185:6;5182:30;5179:56;;;5215:18;;:::i;:::-;-1:-1:-1;5272:2:1;5260:15;-1:-1:-1;;5256:88:1;5346:4;5252:99;;5112:245::o;5362:462::-;5404:5;5457:3;5450:4;5442:6;5438:17;5434:27;5424:55;;5475:1;5472;5465:12;5424:55;5511:6;5498:20;5542:48;5558:31;5586:2;5558:31;:::i;:::-;5542:48;:::i;:::-;5615:2;5606:7;5599:19;5661:3;5654:4;5649:2;5641:6;5637:15;5633:26;5630:35;5627:55;;;5678:1;5675;5668:12;5627:55;5743:2;5736:4;5728:6;5724:17;5717:4;5708:7;5704:18;5691:55;5791:1;5766:16;;;5784:4;5762:27;5755:38;;;;5770:7;5362:462;-1:-1:-1;;;5362:462:1:o;5829:455::-;5906:6;5914;5967:2;5955:9;5946:7;5942:23;5938:32;5935:52;;;5983:1;5980;5973:12;5935:52;6023:9;6010:23;6056:18;6048:6;6045:30;6042:50;;;6088:1;6085;6078:12;6042:50;6111:49;6152:7;6143:6;6132:9;6128:22;6111:49;:::i;:::-;6101:59;;;6210:2;6199:9;6195:18;6182:32;6223:31;6248:5;6223:31;:::i;6289:121::-;6374:10;6367:5;6363:22;6356:5;6353:33;6343:61;;6400:1;6397;6390:12;6415:132;6482:20;;6511:30;6482:20;6511:30;:::i;6552:118::-;6638:5;6631:13;6624:21;6617:5;6614:32;6604:60;;6660:1;6657;6650:12;6675:128;6740:20;;6769:28;6740:20;6769:28;:::i;6808:806::-;6867:5;6915:6;6903:9;6898:3;6894:19;6890:32;6887:52;;;6935:1;6932;6925:12;6887:52;6957:22;;:::i;:::-;6948:31;;7002:28;7020:9;7002:28;:::i;:::-;6995:5;6988:43;7063:38;7097:2;7086:9;7082:18;7063:38;:::i;:::-;7058:2;7051:5;7047:14;7040:62;7134:38;7168:2;7157:9;7153:18;7134:38;:::i;:::-;7129:2;7122:5;7118:14;7111:62;7205:38;7239:2;7228:9;7224:18;7205:38;:::i;:::-;7200:2;7193:5;7189:14;7182:62;7277:39;7311:3;7300:9;7296:19;7277:39;:::i;:::-;7271:3;7264:5;7260:15;7253:64;7378:3;7367:9;7363:19;7350:33;7344:3;7337:5;7333:15;7326:58;7445:3;7434:9;7430:19;7417:33;7411:3;7404:5;7400:15;7393:58;7484:36;7515:3;7504:9;7500:19;7484:36;:::i;:::-;7478:3;7471:5;7467:15;7460:61;7540:3;7603:2;7592:9;7588:18;7575:32;7570:2;7563:5;7559:14;7552:56;;6808:806;;;;:::o;7619:237::-;7707:6;7760:3;7748:9;7739:7;7735:23;7731:33;7728:53;;;7777:1;7774;7767:12;7728:53;7800:50;7842:7;7831:9;7800:50;:::i;7861:320::-;7929:6;7982:2;7970:9;7961:7;7957:23;7953:32;7950:52;;;7998:1;7995;7988:12;7950:52;8038:9;8025:23;8071:18;8063:6;8060:30;8057:50;;;8103:1;8100;8093:12;8057:50;8126:49;8167:7;8158:6;8147:9;8143:22;8126:49;:::i;:::-;8116:59;7861:320;-1:-1:-1;;;;7861:320:1:o;8417:250::-;8502:1;8512:113;8526:6;8523:1;8520:13;8512:113;;;8602:11;;;8596:18;8583:11;;;8576:39;8548:2;8541:10;8512:113;;;-1:-1:-1;;8659:1:1;8641:16;;8634:27;8417:250::o;8672:329::-;8713:3;8751:5;8745:12;8778:6;8773:3;8766:19;8794:76;8863:6;8856:4;8851:3;8847:14;8840:4;8833:5;8829:16;8794:76;:::i;:::-;8915:2;8903:15;-1:-1:-1;;8899:88:1;8890:98;;;;8990:4;8886:109;;8672:329;-1:-1:-1;;8672:329:1:o;9006:1866::-;9209:2;9198:9;9191:21;9221:52;9269:2;9258:9;9254:18;9245:6;9239:13;8262:10;8251:22;8239:35;;8186:94;9221:52;9172:4;9320:2;9312:6;9308:15;9302:22;9333:51;9380:2;9369:9;9365:18;9351:12;8262:10;8251:22;8239:35;;8186:94;9333:51;-1:-1:-1;9433:2:1;9421:15;;9415:22;-1:-1:-1;;;;;8351:54:1;;9496:2;9481:18;;8339:67;-1:-1:-1;9549:2:1;9537:15;;9531:22;-1:-1:-1;;;;;8351:54:1;;9612:3;9597:19;;8339:67;-1:-1:-1;9666:3:1;9654:16;;9648:23;-1:-1:-1;;;;;8351:54:1;;9730:3;9715:19;;8339:67;-1:-1:-1;9784:3:1;9772:16;;9766:23;-1:-1:-1;;;;;8351:54:1;;9848:3;9833:19;;8339:67;-1:-1:-1;9908:3:1;9896:16;;9890:23;9884:3;9869:19;;;9862:52;;;;9939:16;;9933:23;9975:3;9994:18;;;9987:30;;;;10042:15;;10036:22;10077:3;10096:18;;;10089:30;;;;10144:15;;10138:22;10179:3;10198:18;;;10191:30;;;;10246:15;;10240:22;10281:3;10300:18;;;10293:30;;;;10348:15;;10342:22;10384:3;10403:19;;;10396:31;;;;10464:16;;10458:23;10501:3;10513:55;10548:19;;;10458:23;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;10513:55;10594:16;;10588:23;10631:3;10650:19;;;10643:32;;;;10712:16;;10706:23;10749:6;10771:19;;;10764:32;10706:23;-1:-1:-1;10813:53:1;10861:3;10846:19;;10706:23;10813:53;:::i;10877:513::-;11106:3;11091:19;;11119:47;11095:9;11148:6;11119:47;:::i;:::-;11214:12;11206:6;11202:25;11197:2;11186:9;11182:18;11175:53;11276:14;11268:6;11264:27;11259:2;11248:9;11244:18;11237:55;-1:-1:-1;;;;;11332:6:1;11328:55;11323:2;11312:9;11308:18;11301:83;10877:513;;;;;;;:::o;11395:388::-;11472:6;11480;11533:2;11521:9;11512:7;11508:23;11504:32;11501:52;;;11549:1;11546;11539:12;11501:52;11589:9;11576:23;11622:18;11614:6;11611:30;11608:50;;;11654:1;11651;11644:12;11608:50;11677:49;11718:7;11709:6;11698:9;11694:22;11677:49;:::i;:::-;11667:59;11773:2;11758:18;;;;11745:32;;-1:-1:-1;;;;11395:388:1:o;11788:248::-;11856:6;11864;11917:2;11905:9;11896:7;11892:23;11888:32;11885:52;;;11933:1;11930;11923:12;11885:52;-1:-1:-1;;11956:23:1;;;12026:2;12011:18;;;11998:32;;-1:-1:-1;11788:248:1:o;12605:1373::-;12836:13;;8262:10;8251:22;8239:35;;12805:3;12790:19;;12908:4;12900:6;12896:17;12890:24;12923:53;12970:4;12959:9;12955:20;12941:12;8262:10;8251:22;8239:35;;8186:94;12923:53;;13025:4;13017:6;13013:17;13007:24;13040:56;13090:4;13079:9;13075:20;13059:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13040:56;;13145:4;13137:6;13133:17;13127:24;13160:56;13210:4;13199:9;13195:20;13179:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13160:56;;13265:4;13257:6;13253:17;13247:24;13280:56;13330:4;13319:9;13315:20;13299:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13280:56;;13385:4;13377:6;13373:17;13367:24;13400:56;13450:4;13439:9;13435:20;13419:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13400:56;;13512:4;13504:6;13500:17;13494:24;13487:4;13476:9;13472:20;13465:54;13575:4;13567:6;13563:17;13557:24;13550:4;13539:9;13535:20;13528:54;13601:6;13661:2;13653:6;13649:15;13643:22;13638:2;13627:9;13623:18;13616:50;;13685:6;13740:2;13732:6;13728:15;13722:22;13753:51;13800:2;13789:9;13785:18;13769:14;421:13;414:21;402:34;;351:91;13753:51;-1:-1:-1;;13823:6:1;13871:15;;;13865:22;13845:18;;;13838:50;13907:6;13955:15;;;13949:22;13929:18;;;;13922:50;;;;12605:1373;:::o;14168:1162::-;14297:6;14305;14358:3;14346:9;14337:7;14333:23;14329:33;14326:53;;;14375:1;14372;14365:12;14326:53;14398:50;14440:7;14429:9;14398:50;:::i;:::-;14388:60;;14499:3;14488:9;14484:19;14471:33;14523:18;14564:2;14556:6;14553:14;14550:34;;;14580:1;14577;14570:12;14550:34;14603:22;;;;14659:4;14641:16;;;14637:27;14634:47;;;14677:1;14674;14667:12;14634:47;14703:22;;:::i;:::-;14762:2;14749:16;14774:33;14799:7;14774:33;:::i;:::-;14816:22;;14891:2;14883:11;;;14870:25;14854:14;;;14847:49;14942:2;14934:11;;14921:25;14958:16;;;14955:36;;;14987:1;14984;14977:12;14955:36;15023:44;15059:7;15048:8;15044:2;15040:17;15023:44;:::i;:::-;15018:2;15011:5;15007:14;15000:68;;15121:2;15117;15113:11;15100:25;15095:2;15088:5;15084:14;15077:49;15172:3;15168:2;15164:12;15151:26;15202:2;15192:8;15189:16;15186:36;;;15218:1;15215;15208:12;15186:36;15255:44;15291:7;15280:8;15276:2;15272:17;15255:44;:::i;:::-;15249:3;15242:5;15238:15;15231:69;;15319:5;15309:15;;;;;14168:1162;;;;;:::o;16158:184::-;16210:77;16207:1;16200:88;16307:4;16304:1;16297:15;16331:4;16328:1;16321:15;16347:125;16412:9;;;16433:10;;;16430:36;;;16446:18;;:::i;16779:136::-;16857:13;;16879:30;16857:13;16879:30;:::i;16920:138::-;16999:13;;17021:31;16999:13;17021:31;:::i;17063:441::-;17116:5;17169:3;17162:4;17154:6;17150:17;17146:27;17136:55;;17187:1;17184;17177:12;17136:55;17216:6;17210:13;17247:48;17263:31;17291:2;17263:31;:::i;17247:48::-;17320:2;17311:7;17304:19;17366:3;17359:4;17354:2;17346:6;17342:15;17338:26;17335:35;17332:55;;;17383:1;17380;17373:12;17332:55;17396:77;17470:2;17463:4;17454:7;17450:18;17443:4;17435:6;17431:17;17396:77;:::i;17509:1672::-;17616:6;17669:2;17657:9;17648:7;17644:23;17640:32;17637:52;;;17685:1;17682;17675:12;17637:52;17718:9;17712:16;17747:18;17788:2;17780:6;17777:14;17774:34;;;17804:1;17801;17794:12;17774:34;17827:22;;;;17883:6;17865:16;;;17861:29;17858:49;;;17903:1;17900;17893:12;17858:49;17929:22;;:::i;:::-;17974:32;18003:2;17974:32;:::i;:::-;17967:5;17960:47;18039:41;18076:2;18072;18068:11;18039:41;:::i;:::-;18034:2;18027:5;18023:14;18016:65;18113:42;18151:2;18147;18143:11;18113:42;:::i;:::-;18108:2;18101:5;18097:14;18090:66;18188:42;18226:2;18222;18218:11;18188:42;:::i;:::-;18183:2;18176:5;18172:14;18165:66;18264:43;18302:3;18298:2;18294:12;18264:43;:::i;:::-;18258:3;18251:5;18247:15;18240:68;18341:43;18379:3;18375:2;18371:12;18341:43;:::i;:::-;18335:3;18324:15;;18317:68;18432:3;18424:12;;;18418:19;18401:15;;;18394:44;18485:3;18477:12;;;18471:19;18454:15;;;18447:44;18510:3;18551:11;;;18545:18;18529:14;;;18522:42;18583:3;18624:11;;;18618:18;18602:14;;;18595:42;18656:3;18697:11;;;18691:18;18675:14;;;18668:42;18729:3;18770:11;;;18764:18;18748:14;;;18741:42;18802:3;18837:42;18867:11;;;18837:42;:::i;:::-;18821:14;;;18814:66;18899:3;18940:11;;;18934:18;18918:14;;;18911:42;18972:3;19006:11;;;19000:18;19030:16;;;19027:36;;;19059:1;19056;19049:12;19027:36;19095:55;19142:7;19131:8;19127:2;19123:17;19095:55;:::i;:::-;19079:14;;;19072:79;;;;-1:-1:-1;19083:5:1;17509:1672;-1:-1:-1;;;;;17509:1672:1:o;19820:217::-;19967:2;19956:9;19949:21;19930:4;19987:44;20027:2;20016:9;20012:18;20004:6;19987:44;:::i;20042:132::-;20118:13;;20140:28;20118:13;20140:28;:::i;20179:1188::-;20282:6;20335:3;20323:9;20314:7;20310:23;20306:33;20303:53;;;20352:1;20349;20342:12;20303:53;20378:22;;:::i;:::-;20423:39;20452:9;20423:39;:::i;:::-;20416:5;20409:54;20495:48;20539:2;20528:9;20524:18;20495:48;:::i;:::-;20490:2;20483:5;20479:14;20472:72;20576:49;20621:2;20610:9;20606:18;20576:49;:::i;:::-;20571:2;20564:5;20560:14;20553:73;20658:49;20703:2;20692:9;20688:18;20658:49;:::i;:::-;20653:2;20646:5;20642:14;20635:73;20741:50;20786:3;20775:9;20771:19;20741:50;:::i;:::-;20735:3;20728:5;20724:15;20717:75;20825:50;20870:3;20859:9;20855:19;20825:50;:::i;:::-;20819:3;20812:5;20808:15;20801:75;20930:3;20919:9;20915:19;20909:26;20903:3;20896:5;20892:15;20885:51;20990:3;20979:9;20975:19;20969:26;20963:3;20956:5;20952:15;20945:51;21015:3;21071:2;21060:9;21056:18;21050:25;21045:2;21038:5;21034:14;21027:49;;21095:3;21130:46;21172:2;21161:9;21157:18;21130:46;:::i;:::-;21114:14;;;21107:70;21196:3;21237:18;;;21231:25;21215:14;;;21208:49;21276:3;21317:18;;;21311:25;21295:14;;;21288:49;;;;-1:-1:-1;21118:5:1;20179:1188;-1:-1:-1;20179:1188:1:o;21970:216::-;22034:9;;;22062:11;;;22009:3;22092:9;;22120:10;;22116:19;;22145:10;;22137:19;;22113:44;22110:70;;;22160:18;;:::i;:::-;22110:70;;21970:216;;;;:::o;22191:168::-;22264:9;;;22295;;22312:15;;;22306:22;;22292:37;22282:71;;22333:18;;:::i;22364:274::-;22404:1;22430;22420:189;;22465:77;22462:1;22455:88;22566:4;22563:1;22556:15;22594:4;22591:1;22584:15;22420:189;-1:-1:-1;22623:9:1;;22364:274::o;22643:128::-;22710:9;;;22731:11;;;22728:37;;;22745:18;;:::i;22776:195::-;22815:3;22846:66;22839:5;22836:77;22833:103;;22916:18;;:::i;:::-;-1:-1:-1;22963:1:1;22952:13;;22776:195::o;22976:752::-;23283:3;23272:9;23265:22;23246:4;23304:45;23344:3;23333:9;23329:19;23321:6;23304:45;:::i;:::-;23397:10;23385:23;;;;23380:2;23365:18;;23358:51;-1:-1:-1;;;;;;23506:15:1;;;23501:2;23486:18;;23479:43;23558:15;;;;23553:2;23538:18;;23531:43;23605:3;23590:19;;23583:35;;;;23649:3;23634:19;;23627:35;23706:14;;23699:22;23693:3;23678:19;;;23671:51;23296:53;22976:752;-1:-1:-1;22976:752:1:o;24291:408::-;-1:-1:-1;;;;;24498:6:1;24494:55;24483:9;24476:74;24586:6;24581:2;24570:9;24566:18;24559:34;24629:2;24624;24613:9;24609:18;24602:30;24457:4;24649:44;24689:2;24678:9;24674:18;24666:6;24649:44;:::i;:::-;24641:52;24291:408;-1:-1:-1;;;;;24291:408:1:o;24704:357::-;24822:12;;24869:4;24858:16;;;24852:23;;24822:12;24887:16;;24884:171;;;24977:66;24967:6;24961:4;24957:17;24954:1;24950:25;24946:98;24939:5;24935:110;24926:119;;24884:171;;24704:357;;;:::o;25066:184::-;25136:6;25189:2;25177:9;25168:7;25164:23;25160:32;25157:52;;;25205:1;25202;25195:12;25157:52;-1:-1:-1;25228:16:1;;25066:184;-1:-1:-1;25066:184:1:o;25557:::-;25609:77;25606:1;25599:88;25706:4;25703:1;25696:15;25730:4;25727:1;25720:15;25746:245;25813:6;25866:2;25854:9;25845:7;25841:23;25837:32;25834:52;;;25882:1;25879;25872:12;25834:52;25914:9;25908:16;25933:28;25955:5;25933:28;:::i;25996:287::-;26125:3;26163:6;26157:13;26179:66;26238:6;26233:3;26226:4;26218:6;26214:17;26179:66;:::i;:::-;26261:16;;;;;25996:287;-1:-1:-1;;25996:287:1:o;26288:184::-;26340:77;26337:1;26330:88;26437:4;26434:1;26427:15;26461:4;26458:1;26451:15","abiDefinition":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AmountIncorrect","type":"error"},{"inputs":[],"name":"CallParamsLengthAboveMax","type":"error"},{"inputs":[],"name":"ChainIncorrect","type":"error"},{"inputs":[],"name":"DeadlineExceeded","type":"error"},{"inputs":[],"name":"DeadlineNotExceeded","type":"error"},{"inputs":[],"name":"DeadlineTooShort","type":"error"},{"inputs":[],"name":"DisputePeriodNotPassed","type":"error"},{"inputs":[],"name":"DisputePeriodPassed","type":"error"},{"inputs":[],"name":"ExclusivityParamsIncorrect","type":"error"},{"inputs":[],"name":"ExclusivityPeriodNotPassed","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","type":"error"},{"inputs":[],"name":"NativeTokenCallValueNotSupported","type":"error"},{"inputs":[],"name":"RecipientIncorrectReturnValue","type":"error"},{"inputs":[],"name":"RecipientNoReturnValue","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SenderIncorrect","type":"error"},{"inputs":[],"name":"StatusIncorrect","type":"error"},{"inputs":[],"name":"TokenNotContract","type":"error"},{"inputs":[],"name":"TransactionRelayed","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"BridgeProofDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"bytes32","name":"transactionHash","type":"bytes32"}],"name":"BridgeProofProvided","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"quoteId","type":"bytes"}],"name":"BridgeQuoteDetails","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint32","name":"originChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainGasAmount","type":"uint256"}],"name":"BridgeRelayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes","name":"request","type":"bytes"},{"indexed":false,"internalType":"uint32","name":"destChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sendChainGas","type":"bool"}],"name":"BridgeRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldChainGasAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"ChainGasAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesSwept","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DISPUTE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RATE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARD_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CALL_PARAMS_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEADLINE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFUNDER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFUND_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"},{"components":[{"internalType":"address","name":"quoteRelayer","type":"address"},{"internalType":"int256","name":"quoteExclusivitySeconds","type":"int256"},{"internalType":"bytes","name":"quoteId","type":"bytes"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeParamsV2","name":"paramsV2","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeProofs","outputs":[{"internalType":"uint96","name":"timestamp","type":"uint96"},{"internalType":"address","name":"relayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeRelayDetails","outputs":[{"internalType":"uint48","name":"blockNumber","type":"uint48"},{"internalType":"uint48","name":"blockTimestamp","type":"uint48"},{"internalType":"address","name":"relayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum IFastBridgeV2.BridgeStatus","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeTxDetails","outputs":[{"internalType":"enum IFastBridgeV2.BridgeStatus","name":"status","type":"uint8"},{"internalType":"uint40","name":"proofBlockTimestamp","type":"uint40"},{"internalType":"uint48","name":"proofBlockNumber","type":"uint48"},{"internalType":"address","name":"proofRelayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainGasAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deployBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"dispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransaction","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IFastBridge.BridgeTransaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransactionV2","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"exclusivityRelayer","type":"address"},{"internalType":"uint256","name":"exclusivityEndTime","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeTransactionV2","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"protocolFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"relayer","type":"address"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"senderNonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"setChainGasAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"setProtocolFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{"DISPUTE_PERIOD()":{"notice":"Dispute period for relayed transactions"},"MAX_CALL_PARAMS_LENGTH()":{"notice":"Maximum length of accepted callParams"},"MIN_DEADLINE_PERIOD()":{"notice":"Minimum deadline period to relay a requested bridge transaction"},"REFUND_DELAY()":{"notice":"Delay for a transaction after which it could be permisionlessly refunded"},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer."},"bridgeProofs(bytes32)":{"notice":"Returns the timestamp and relayer of a bridge proof"},"bridgeRelayDetails(bytes32)":{"notice":"Relay details on destination chain"},"bridgeRelays(bytes32)":{"notice":"Checks if a transaction has been relayed"},"bridgeStatuses(bytes32)":{"notice":"Returns the status of a bridge transaction"},"bridgeTxDetails(bytes32)":{"notice":"Status of the bridge tx on origin chain"},"canClaim(bytes32,address)":{"notice":"Checks if the dispute period has passed so bridge deposit can be claimed"},"chainGasAmount()":{"notice":"Chain gas amount to forward as rebate if requested"},"claim(bytes)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof."},"claim(bytes,address)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital"},"deployBlock()":{"notice":"the block the contract was deployed at"},"dispute(bytes32)":{"notice":"Disputes an outstanding proof in case relayer provided dest chain tx is invalid"},"getBridgeTransaction(bytes)":{"notice":"Decodes bridge request into a bridge transaction"},"getBridgeTransactionV2(bytes)":{"notice":"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2"},"nonce()":{"notice":"This is deprecated and should not be used."},"protocolFeeRate()":{"notice":"Protocol fee rate taken on origin amount deposited in origin chain"},"protocolFees(address)":{"notice":"Protocol fee amounts accumulated"},"prove(bytes,bytes32)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"prove(bytes32,bytes32,address)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"refund(bytes)":{"notice":"Refunds an outstanding bridge transaction in case optimistic bridging failed"},"relay(bytes)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"},"relay(bytes,address)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"},"senderNonces(address)":{"notice":"Unique bridge nonces tracked per originSender"}},"notice":"FastBridgeV2 is a contract for bridging tokens across chains.","version":1},"developerDoc":{"errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}],"AddressEmptyCode(address)":[{"details":"There's no code at `target` (it is not a contract)."}],"AddressInsufficientBalance(address)":[{"details":"The ETH balance of the account is not enough to perform the operation."}],"FailedInnerCall()":[{"details":"A call to an address target failed. The target may have reverted."}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC20 token failed."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"params":{"params":"The parameters required to bridge"}},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"params":{"params":"The parameters required to bridge","paramsV2":"The parameters for exclusivity fill rights (optional, can be left empty)"}},"bridgeProofs(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"relayer":"The relayer address of the bridge proof","timestamp":"The timestamp of the bridge proof"}},"bridgeRelays(bytes32)":{"params":{"transactionId":"The ID of the transaction to check"},"returns":{"_0":"True if the transaction has been relayed, false otherwise"}},"bridgeStatuses(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"status":"BridgeStatus Status of the bridge transaction"}},"canClaim(bytes32,address)":{"params":{"relayer":"The address of the relayer attempting to claim","transactionId":"The transaction id associated with the encoded bridge transaction to check"}},"claim(bytes)":{"params":{"request":"The encoded bridge transaction to claim on origin chain"}},"claim(bytes,address)":{"params":{"request":"The encoded bridge transaction to claim on origin chain","to":"The recipient address of the funds"}},"dispute(bytes32)":{"params":{"transactionId":"The transaction id associated with the encoded bridge transaction to dispute"}},"getBridgeTransaction(bytes)":{"details":"This method is added to achieve backwards compatibility with decoding requests into V1 structs: - `callValue` is partially reported as a zero/non-zero flag - `callParams` is ignored In order to process all kinds of requests use getBridgeTransactionV2 instead.","params":{"request":"The bridge request to decode"}},"getBridgeTransactionV2(bytes)":{"params":{"request":"The bridge request to decode"}},"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"prove(bytes,bytes32)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","request":"The encoded bridge transaction to prove on origin chain"}},"prove(bytes32,bytes32,address)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","relayer":"The address of the relaying entity which should have control of the origin funds when claimed","transactionId":"The transaction id associated with the encoded bridge transaction to prove"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"request":"The encoded bridge transaction to relay on destination chain"}},"relay(bytes,address)":{"params":{"relayer":"The address of the relaying entity which should have control of the origin funds when claimed","request":"The encoded bridge transaction to relay on destination chain"}},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"stateVariables":{"nonce":{"details":"Replaced by senderNonces"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AmountIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallParamsLengthAboveMax\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChainIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineNotExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityParamsIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NativeTokenCallValueNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientIncorrectReturnValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientNoReturnValue\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StatusIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransactionRelayed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"BridgeProofDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"transactionHash\",\"type\":\"bytes32\"}],\"name\":\"BridgeProofProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"}],\"name\":\"BridgeQuoteDetails\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"}],\"name\":\"BridgeRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldChainGasAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"ChainGasAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldFeeRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"FeeRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FeesSwept\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DISPUTE_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_BPS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_RATE_MAX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOVERNOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GUARD_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_CALL_PARAMS_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_DEADLINE_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REFUNDER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REFUND_DELAY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"quoteRelayer\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"quoteExclusivitySeconds\",\"type\":\"int256\"},{\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeParamsV2\",\"name\":\"paramsV2\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeProofs\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"timestamp\",\"type\":\"uint96\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeRelayDetails\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"blockNumber\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"blockTimestamp\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum IFastBridgeV2.BridgeStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeTxDetails\",\"outputs\":[{\"internalType\":\"enum IFastBridgeV2.BridgeStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"uint40\",\"name\":\"proofBlockTimestamp\",\"type\":\"uint40\"},{\"internalType\":\"uint48\",\"name\":\"proofBlockNumber\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"proofRelayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"canClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"chainGasAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deployBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransaction\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeTransaction\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransactionV2\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"exclusivityRelayer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exclusivityEndTime\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeTransactionV2\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"protocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"senderNonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"setChainGasAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"sweepProtocolFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}],\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"params\":{\"params\":\"The parameters required to bridge\"}},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"params\":{\"params\":\"The parameters required to bridge\",\"paramsV2\":\"The parameters for exclusivity fill rights (optional, can be left empty)\"}},\"bridgeProofs(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"relayer\":\"The relayer address of the bridge proof\",\"timestamp\":\"The timestamp of the bridge proof\"}},\"bridgeRelays(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the transaction to check\"},\"returns\":{\"_0\":\"True if the transaction has been relayed, false otherwise\"}},\"bridgeStatuses(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"status\":\"BridgeStatus Status of the bridge transaction\"}},\"canClaim(bytes32,address)\":{\"params\":{\"relayer\":\"The address of the relayer attempting to claim\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to check\"}},\"claim(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\"}},\"claim(bytes,address)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\",\"to\":\"The recipient address of the funds\"}},\"dispute(bytes32)\":{\"params\":{\"transactionId\":\"The transaction id associated with the encoded bridge transaction to dispute\"}},\"getBridgeTransaction(bytes)\":{\"details\":\"This method is added to achieve backwards compatibility with decoding requests into V1 structs: - `callValue` is partially reported as a zero/non-zero flag - `callParams` is ignored In order to process all kinds of requests use getBridgeTransactionV2 instead.\",\"params\":{\"request\":\"The bridge request to decode\"}},\"getBridgeTransactionV2(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"prove(bytes,bytes32)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"request\":\"The encoded bridge transaction to prove on origin chain\"}},\"prove(bytes32,bytes32,address)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to prove\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to relay on destination chain\"}},\"relay(bytes,address)\":{\"params\":{\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"request\":\"The encoded bridge transaction to relay on destination chain\"}},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"stateVariables\":{\"nonce\":{\"details\":\"Replaced by senderNonces\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DISPUTE_PERIOD()\":{\"notice\":\"Dispute period for relayed transactions\"},\"MAX_CALL_PARAMS_LENGTH()\":{\"notice\":\"Maximum length of accepted callParams\"},\"MIN_DEADLINE_PERIOD()\":{\"notice\":\"Minimum deadline period to relay a requested bridge transaction\"},\"REFUND_DELAY()\":{\"notice\":\"Delay for a transaction after which it could be permisionlessly refunded\"},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer\"},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer.\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Returns the timestamp and relayer of a bridge proof\"},\"bridgeRelayDetails(bytes32)\":{\"notice\":\"Relay details on destination chain\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Checks if a transaction has been relayed\"},\"bridgeStatuses(bytes32)\":{\"notice\":\"Returns the status of a bridge transaction\"},\"bridgeTxDetails(bytes32)\":{\"notice\":\"Status of the bridge tx on origin chain\"},\"canClaim(bytes32,address)\":{\"notice\":\"Checks if the dispute period has passed so bridge deposit can be claimed\"},\"chainGasAmount()\":{\"notice\":\"Chain gas amount to forward as rebate if requested\"},\"claim(bytes)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof.\"},\"claim(bytes,address)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital\"},\"deployBlock()\":{\"notice\":\"the block the contract was deployed at\"},\"dispute(bytes32)\":{\"notice\":\"Disputes an outstanding proof in case relayer provided dest chain tx is invalid\"},\"getBridgeTransaction(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction\"},\"getBridgeTransactionV2(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\"},\"nonce()\":{\"notice\":\"This is deprecated and should not be used.\"},\"protocolFeeRate()\":{\"notice\":\"Protocol fee rate taken on origin amount deposited in origin chain\"},\"protocolFees(address)\":{\"notice\":\"Protocol fee amounts accumulated\"},\"prove(bytes,bytes32)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"prove(bytes32,bytes32,address)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"refund(bytes)\":{\"notice\":\"Refunds an outstanding bridge transaction in case optimistic bridging failed\"},\"relay(bytes)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"},\"relay(bytes,address)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"},\"senderNonces(address)\":{\"notice\":\"Unique bridge nonces tracked per originSender\"}},\"notice\":\"FastBridgeV2 is a contract for bridging tokens across chains.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"FastBridgeV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","DISPUTE_PERIOD()":"a5bbe22b","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","MAX_CALL_PARAMS_LENGTH()":"df36bb13","MIN_DEADLINE_PERIOD()":"820688d5","REFUNDER_ROLE()":"5960ccf2","REFUND_DELAY()":"190da595","RELAYER_ROLE()":"926d7d7f","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":"bfc7c607","bridgeProofs(bytes32)":"91ad5039","bridgeRelayDetails(bytes32)":"c79371b1","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","bridgeTxDetails(bytes32)":"63787e52","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes)":"c63ff8dd","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","getBridgeTransactionV2(bytes)":"5aa6ccba","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","nonce()":"affed0e0","protocolFeeRate()":"58f85880","protocolFees(address)":"dcf844a7","prove(bytes,bytes32)":"886d36ff","prove(bytes32,bytes32,address)":"18e4357d","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","relay(bytes,address)":"9c9545f0","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","senderNonces(address)":"295710ff","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeV2.sol:IAccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"External interface of AccessControl declared to support ERC165 detection.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"External interface of AccessControl declared to support ERC165 detection.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IAccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridgeV2.sol:IAccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"External interface of AccessControlEnumerable declared to support ERC165 detection.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"External interface of AccessControlEnumerable declared to support ERC165 detection.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IAccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridgeV2.sol:IAdmin":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldChainGasAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"ChainGasAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesSwept","type":"event"},{"inputs":[{"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"setChainGasAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"setProtocolFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldChainGasAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"ChainGasAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldFeeRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"FeeRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FeesSwept\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"setChainGasAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"sweepProtocolFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IAdmin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeV2.sol:IERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.","kind":"dev","methods":{"supportsInterface(bytes4)":{"details":"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Interface of the ERC20 standard as defined in the EIP.","events":{"Approval(address,address,uint256)":{"details":"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance."},"Transfer(address,address,uint256)":{"details":"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero."}},"kind":"dev","methods":{"allowance(address,address)":{"details":"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called."},"approve(address,uint256)":{"details":"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event."},"balanceOf(address)":{"details":"Returns the value of tokens owned by `account`."},"totalSupply()":{"details":"Returns the value of tokens in existence."},"transfer(address,uint256)":{"details":"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event."},"transferFrom(address,address,uint256)":{"details":"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC20 standard as defined in the EIP.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}},"solidity/FastBridgeV2.sol:IERC20Permit":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.","kind":"dev","methods":{"DOMAIN_SEPARATOR()":{"details":"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}."},"nonces(address)":{"details":"Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times."},"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":{"details":"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.\",\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\"},\"nonces(address)\":{\"details\":\"Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IERC20Permit\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"DOMAIN_SEPARATOR()":"3644e515","nonces(address)":"7ecebe00","permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":"d505accf"}},"solidity/FastBridgeV2.sol:IFastBridge":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"BridgeProofDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"bytes32","name":"transactionHash","type":"bytes32"}],"name":"BridgeProofProvided","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint32","name":"originChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainGasAmount","type":"uint256"}],"name":"BridgeRelayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes","name":"request","type":"bytes"},{"indexed":false,"internalType":"uint32","name":"destChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sendChainGas","type":"bool"}],"name":"BridgeRequested","type":"event"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"dispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransaction","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IFastBridge.BridgeTransaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"}],"userDoc":{"kind":"user","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"canClaim(bytes32,address)":{"notice":"Checks if the dispute period has passed so bridge deposit can be claimed"},"claim(bytes,address)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital"},"dispute(bytes32)":{"notice":"Disputes an outstanding proof in case relayer provided dest chain tx is invalid"},"getBridgeTransaction(bytes)":{"notice":"Decodes bridge request into a bridge transaction"},"prove(bytes,bytes32)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"refund(bytes)":{"notice":"Refunds an outstanding bridge transaction in case optimistic bridging failed"},"relay(bytes)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"}},"version":1},"developerDoc":{"kind":"dev","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"params":{"params":"The parameters required to bridge"}},"canClaim(bytes32,address)":{"params":{"relayer":"The address of the relayer attempting to claim","transactionId":"The transaction id associated with the encoded bridge transaction to check"}},"claim(bytes,address)":{"params":{"request":"The encoded bridge transaction to claim on origin chain","to":"The recipient address of the funds"}},"dispute(bytes32)":{"params":{"transactionId":"The transaction id associated with the encoded bridge transaction to dispute"}},"getBridgeTransaction(bytes)":{"params":{"request":"The bridge request to decode"}},"prove(bytes,bytes32)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","request":"The encoded bridge transaction to prove on origin chain"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"request":"The encoded bridge transaction to relay on destination chain"}}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"BridgeProofDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"transactionHash\",\"type\":\"bytes32\"}],\"name\":\"BridgeProofProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"}],\"name\":\"BridgeRequested\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"canClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransaction\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeTransaction\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"params\":{\"params\":\"The parameters required to bridge\"}},\"canClaim(bytes32,address)\":{\"params\":{\"relayer\":\"The address of the relayer attempting to claim\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to check\"}},\"claim(bytes,address)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\",\"to\":\"The recipient address of the funds\"}},\"dispute(bytes32)\":{\"params\":{\"transactionId\":\"The transaction id associated with the encoded bridge transaction to dispute\"}},\"getBridgeTransaction(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"prove(bytes,bytes32)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"request\":\"The encoded bridge transaction to prove on origin chain\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to relay on destination chain\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer\"},\"canClaim(bytes32,address)\":{\"notice\":\"Checks if the dispute period has passed so bridge deposit can be claimed\"},\"claim(bytes,address)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital\"},\"dispute(bytes32)\":{\"notice\":\"Disputes an outstanding proof in case relayer provided dest chain tx is invalid\"},\"getBridgeTransaction(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction\"},\"prove(bytes,bytes32)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"refund(bytes)\":{\"notice\":\"Refunds an outstanding bridge transaction in case optimistic bridging failed\"},\"relay(bytes)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","canClaim(bytes32,address)":"aa9641ab","claim(bytes,address)":"41fcb612","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","prove(bytes,bytes32)":"886d36ff","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17"}},"solidity/FastBridgeV2.sol:IFastBridgeRecipient":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"name":"fastBridgeTransferReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"payable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"name\":\"fastBridgeTransferReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridgeRecipient\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"fastBridgeTransferReceived(address,uint256,bytes)":"461e0c21"}},"solidity/FastBridgeV2.sol:IFastBridgeV2":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"BridgeProofDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"bytes32","name":"transactionHash","type":"bytes32"}],"name":"BridgeProofProvided","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"quoteId","type":"bytes"}],"name":"BridgeQuoteDetails","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint32","name":"originChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainGasAmount","type":"uint256"}],"name":"BridgeRelayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes","name":"request","type":"bytes"},{"indexed":false,"internalType":"uint32","name":"destChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sendChainGas","type":"bool"}],"name":"BridgeRequested","type":"event"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"},{"components":[{"internalType":"address","name":"quoteRelayer","type":"address"},{"internalType":"int256","name":"quoteExclusivitySeconds","type":"int256"},{"internalType":"bytes","name":"quoteId","type":"bytes"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeParamsV2","name":"paramsV2","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeProofs","outputs":[{"internalType":"uint96","name":"timestamp","type":"uint96"},{"internalType":"address","name":"relayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum IFastBridgeV2.BridgeStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"dispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransaction","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IFastBridge.BridgeTransaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransactionV2","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"exclusivityRelayer","type":"address"},{"internalType":"uint256","name":"exclusivityEndTime","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeTransactionV2","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"relayer","type":"address"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"}],"userDoc":{"kind":"user","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer."},"bridgeProofs(bytes32)":{"notice":"Returns the timestamp and relayer of a bridge proof"},"bridgeRelays(bytes32)":{"notice":"Checks if a transaction has been relayed"},"bridgeStatuses(bytes32)":{"notice":"Returns the status of a bridge transaction"},"canClaim(bytes32,address)":{"notice":"Checks if the dispute period has passed so bridge deposit can be claimed"},"claim(bytes)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof."},"claim(bytes,address)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital"},"dispute(bytes32)":{"notice":"Disputes an outstanding proof in case relayer provided dest chain tx is invalid"},"getBridgeTransaction(bytes)":{"notice":"Decodes bridge request into a bridge transaction"},"getBridgeTransactionV2(bytes)":{"notice":"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2"},"prove(bytes,bytes32)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"prove(bytes32,bytes32,address)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"refund(bytes)":{"notice":"Refunds an outstanding bridge transaction in case optimistic bridging failed"},"relay(bytes)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"},"relay(bytes,address)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"}},"version":1},"developerDoc":{"kind":"dev","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"params":{"params":"The parameters required to bridge"}},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"params":{"params":"The parameters required to bridge","paramsV2":"The parameters for exclusivity fill rights (optional, can be left empty)"}},"bridgeProofs(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"relayer":"The relayer address of the bridge proof","timestamp":"The timestamp of the bridge proof"}},"bridgeRelays(bytes32)":{"params":{"transactionId":"The ID of the transaction to check"},"returns":{"_0":"True if the transaction has been relayed, false otherwise"}},"bridgeStatuses(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"_0":"BridgeStatus Status of the bridge transaction"}},"canClaim(bytes32,address)":{"params":{"relayer":"The address of the relayer attempting to claim","transactionId":"The transaction id associated with the encoded bridge transaction to check"}},"claim(bytes)":{"params":{"request":"The encoded bridge transaction to claim on origin chain"}},"claim(bytes,address)":{"params":{"request":"The encoded bridge transaction to claim on origin chain","to":"The recipient address of the funds"}},"dispute(bytes32)":{"params":{"transactionId":"The transaction id associated with the encoded bridge transaction to dispute"}},"getBridgeTransaction(bytes)":{"params":{"request":"The bridge request to decode"}},"getBridgeTransactionV2(bytes)":{"params":{"request":"The bridge request to decode"}},"prove(bytes,bytes32)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","request":"The encoded bridge transaction to prove on origin chain"}},"prove(bytes32,bytes32,address)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","relayer":"The address of the relaying entity which should have control of the origin funds when claimed","transactionId":"The transaction id associated with the encoded bridge transaction to prove"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"request":"The encoded bridge transaction to relay on destination chain"}},"relay(bytes,address)":{"params":{"relayer":"The address of the relaying entity which should have control of the origin funds when claimed","request":"The encoded bridge transaction to relay on destination chain"}}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"BridgeProofDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"transactionHash\",\"type\":\"bytes32\"}],\"name\":\"BridgeProofProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"}],\"name\":\"BridgeQuoteDetails\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"}],\"name\":\"BridgeRequested\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"quoteRelayer\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"quoteExclusivitySeconds\",\"type\":\"int256\"},{\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeParamsV2\",\"name\":\"paramsV2\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeProofs\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"timestamp\",\"type\":\"uint96\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum IFastBridgeV2.BridgeStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"canClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransaction\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeTransaction\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransactionV2\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"exclusivityRelayer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exclusivityEndTime\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeTransactionV2\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"params\":{\"params\":\"The parameters required to bridge\"}},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"params\":{\"params\":\"The parameters required to bridge\",\"paramsV2\":\"The parameters for exclusivity fill rights (optional, can be left empty)\"}},\"bridgeProofs(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"relayer\":\"The relayer address of the bridge proof\",\"timestamp\":\"The timestamp of the bridge proof\"}},\"bridgeRelays(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the transaction to check\"},\"returns\":{\"_0\":\"True if the transaction has been relayed, false otherwise\"}},\"bridgeStatuses(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"_0\":\"BridgeStatus Status of the bridge transaction\"}},\"canClaim(bytes32,address)\":{\"params\":{\"relayer\":\"The address of the relayer attempting to claim\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to check\"}},\"claim(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\"}},\"claim(bytes,address)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\",\"to\":\"The recipient address of the funds\"}},\"dispute(bytes32)\":{\"params\":{\"transactionId\":\"The transaction id associated with the encoded bridge transaction to dispute\"}},\"getBridgeTransaction(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"getBridgeTransactionV2(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"prove(bytes,bytes32)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"request\":\"The encoded bridge transaction to prove on origin chain\"}},\"prove(bytes32,bytes32,address)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to prove\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to relay on destination chain\"}},\"relay(bytes,address)\":{\"params\":{\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"request\":\"The encoded bridge transaction to relay on destination chain\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer\"},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer.\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Returns the timestamp and relayer of a bridge proof\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Checks if a transaction has been relayed\"},\"bridgeStatuses(bytes32)\":{\"notice\":\"Returns the status of a bridge transaction\"},\"canClaim(bytes32,address)\":{\"notice\":\"Checks if the dispute period has passed so bridge deposit can be claimed\"},\"claim(bytes)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof.\"},\"claim(bytes,address)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital\"},\"dispute(bytes32)\":{\"notice\":\"Disputes an outstanding proof in case relayer provided dest chain tx is invalid\"},\"getBridgeTransaction(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction\"},\"getBridgeTransactionV2(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\"},\"prove(bytes,bytes32)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"prove(bytes32,bytes32,address)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"refund(bytes)\":{\"notice\":\"Refunds an outstanding bridge transaction in case optimistic bridging failed\"},\"relay(bytes)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"},\"relay(bytes,address)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridgeV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":"bfc7c607","bridgeProofs(bytes32)":"91ad5039","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","canClaim(bytes32,address)":"aa9641ab","claim(bytes)":"c63ff8dd","claim(bytes,address)":"41fcb612","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","getBridgeTransactionV2(bytes)":"5aa6ccba","prove(bytes,bytes32)":"886d36ff","prove(bytes32,bytes32,address)":"18e4357d","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","relay(bytes,address)":"9c9545f0"}},"solidity/FastBridgeV2.sol:IFastBridgeV2Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AmountIncorrect","type":"error"},{"inputs":[],"name":"CallParamsLengthAboveMax","type":"error"},{"inputs":[],"name":"ChainIncorrect","type":"error"},{"inputs":[],"name":"DeadlineExceeded","type":"error"},{"inputs":[],"name":"DeadlineNotExceeded","type":"error"},{"inputs":[],"name":"DeadlineTooShort","type":"error"},{"inputs":[],"name":"DisputePeriodNotPassed","type":"error"},{"inputs":[],"name":"DisputePeriodPassed","type":"error"},{"inputs":[],"name":"ExclusivityParamsIncorrect","type":"error"},{"inputs":[],"name":"ExclusivityPeriodNotPassed","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","type":"error"},{"inputs":[],"name":"NativeTokenCallValueNotSupported","type":"error"},{"inputs":[],"name":"RecipientIncorrectReturnValue","type":"error"},{"inputs":[],"name":"RecipientNoReturnValue","type":"error"},{"inputs":[],"name":"SenderIncorrect","type":"error"},{"inputs":[],"name":"StatusIncorrect","type":"error"},{"inputs":[],"name":"TransactionRelayed","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AmountIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallParamsLengthAboveMax\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChainIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineNotExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityParamsIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NativeTokenCallValueNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientIncorrectReturnValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientNoReturnValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StatusIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransactionRelayed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridgeV2Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:SafeERC20":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202e6244574a9418b179bbe1f5d6f1483cf0da887e64158bb04463fae84495de4464736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212202e6244574a9418b179bbe1f5d6f1483cf0da887e64158bb04463fae84495de4464736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"45745:5018:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;45745:5018:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"45745:5018:0:-:0;;;;;;;;","abiDefinition":[{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"currentAllowance","type":"uint256"},{"internalType":"uint256","name":"requestedDecrease","type":"uint256"}],"name":"SafeERC20FailedDecreaseAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.","errors":{"SafeERC20FailedDecreaseAllowance(address,uint256,uint256)":[{"details":"Indicates a failed `decreaseAllowance` request."}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC20 token failed."}]},"kind":"dev","methods":{},"title":"SafeERC20","version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"currentAllowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestedDecrease\",\"type\":\"uint256\"}],\"name\":\"SafeERC20FailedDecreaseAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\",\"errors\":{\"SafeERC20FailedDecreaseAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failed `decreaseAllowance` request.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeERC20\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:UniversalTokenLib":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f32c0660d6e44933a56619135234122fa7c42eeae2b3df059ed3d1e4d3c16aa264736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f32c0660d6e44933a56619135234122fa7c42eeae2b3df059ed3d1e4d3c16aa264736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _pullToken(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (transaction.callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != transaction.callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: transaction.destToken,\n originAmount: transaction.originAmount,\n destAmount: transaction.destAmount,\n chainGasAmount: transaction.callValue\n });\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Pulls a requested token from the user to this contract.\n function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct\n if (amount != msg.value) revert MsgValueIncorrect();\n amountPulled = msg.value;\n } else {\n token.assertIsContract();\n // Record token balance before transfer\n amountPulled = IERC20(token).balanceOf(address(this));\n // Token needs to be pulled only if msg.value is zero\n // This way user can specify WETH as the origin asset\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the difference between the recorded balance and the current balance as the amountPulled\n amountPulled = IERC20(token).balanceOf(address(this)) - amountPulled;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != uint32(block.chainid)) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"57704:2551:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;57704:2551:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"57704:2551:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"UniversalTokenLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0x7cd0f885e80e2bdaa638bc32ae7af7d2e248f99ce4b354c217d0f0f7d7302e0a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7ccf28df0bd7b4606986585acd8622ed9b4e81379690061bb66088f0a2270af1\",\"dweb:/ipfs/QmTf7HNdHZkK6vmx8ZgewycQEb72oLD9nPwBpsM5reMstQ\"]}},\"version\":1}"},"hashes":{}}} \ No newline at end of file +{"solidity/FastBridgeV2.sol:AccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Contract module that allows children to implement role-based access control mechanisms. This is a lightweight version that doesn't allow enumerating role members except through off-chain means by accessing the contract event logs. Some applications may benefit from on-chain enumerability, for those cases see {AccessControlEnumerable}. Roles are referred to by their `bytes32` identifier. These should be exposed in the external API and be unique. The best way to achieve this is by using `public constant` hash digests: ```solidity bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\"); ``` Roles can be used to represent a set of permissions. To restrict access to a function call, use {hasRole}: ```solidity function foo() public { require(hasRole(MY_ROLE, msg.sender)); ... } ``` Roles can be granted and revoked dynamically via the {grantRole} and {revokeRole} functions. Each role has an associated admin role, and only accounts that have a role's admin role can call {grantRole} and {revokeRole}. By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means that only accounts with this role will be able to grant or revoke other roles. More complex role relationships can be created by using {_setRoleAdmin}. WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to grant and revoke this role. Extra precautions should be taken to secure accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} to enforce additional security measures for this role.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Contract module that allows children to implement role-based access control mechanisms. This is a lightweight version that doesn't allow enumerating role members except through off-chain means by accessing the contract event logs. Some applications may benefit from on-chain enumerability, for those cases see {AccessControlEnumerable}. Roles are referred to by their `bytes32` identifier. These should be exposed in the external API and be unique. The best way to achieve this is by using `public constant` hash digests: ```solidity bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\"); ``` Roles can be used to represent a set of permissions. To restrict access to a function call, use {hasRole}: ```solidity function foo() public { require(hasRole(MY_ROLE, msg.sender)); ... } ``` Roles can be granted and revoked dynamically via the {grantRole} and {revokeRole} functions. Each role has an associated admin role, and only accounts that have a role's admin role can call {grantRole} and {revokeRole}. By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means that only accounts with this role will be able to grant or revoke other roles. More complex role relationships can be created by using {_setRoleAdmin}. WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to grant and revoke this role. Extra precautions should be taken to secure accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} to enforce additional security measures for this role.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"AccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:AccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Extension of {AccessControl} that allows enumerating the members of each role.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Extension of {AccessControl} that allows enumerating the members of each role.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"AccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:Address":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ac16750f49f1b9ced08b049feacc7b593708109660ad4859d5e0cc87a7718b8d64736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ac16750f49f1b9ced08b049feacc7b593708109660ad4859d5e0cc87a7718b8d64736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"16564:6066:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;16564:6066:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"16564:6066:0:-:0;;;;;;;;","abiDefinition":[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Collection of functions related to the address type","errors":{"AddressEmptyCode(address)":[{"details":"There's no code at `target` (it is not a contract)."}],"AddressInsufficientBalance(address)":[{"details":"The ETH balance of the account is not enough to perform the operation."}],"FailedInnerCall()":[{"details":"A call to an address target failed. The target may have reverted."}]},"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Collection of functions related to the address type\",\"errors\":{\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}]},\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:Admin":{"code":"0x60806040523480156200001157600080fd5b50604051620014123803806200141283398101604081905262000034916200018e565b6200004160008262000049565b5050620001b9565b60008062000058848462000086565b905080156200007d5760008481526001602052604090206200007b908462000134565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff166200012b576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000e23390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000080565b50600062000080565b60006200007d836001600160a01b03841660008181526001830160205260408120546200012b5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000080565b600060208284031215620001a157600080fd5b81516001600160a01b03811681146200007d57600080fd5b61124980620001c96000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220b13443229221519c0fdb3ac2db22c34ccdfff8fd9f142c9a058dcefb00a5a9d864736f6c63430008180033","runtime-code":"0x608060405234801561001057600080fd5b50600436106101775760003560e01c806391d14854116100d8578063bf333f2c1161008c578063d547741f11610066578063d547741f14610385578063dcf844a714610398578063e00a83e0146103b857600080fd5b8063bf333f2c14610341578063ca15c8731461034b578063ccc574901461035e57600080fd5b8063a217fddf116100bd578063a217fddf14610313578063b13aa2d61461031b578063b250fe6b1461032e57600080fd5b806391d14854146102a8578063926d7d7f146102ec57600080fd5b80632f2ff15d1161012f57806358f858801161011457806358f85880146102405780635960ccf2146102495780639010d07c1461027057600080fd5b80632f2ff15d1461021a57806336568abe1461022d57600080fd5b806306f333f21161016057806306f333f2146101d95780630f5f6ed7146101ee578063248a9ca3146101f757600080fd5b806301ffc9a71461017c57806303ed0ee5146101a4575b600080fd5b61018f61018a366004611013565b6103c1565b60405190151581526020015b60405180910390f35b6101cb7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161019b565b6101ec6101e736600461107e565b61041d565b005b6101cb61271081565b6101cb6102053660046110b1565b60009081526020819052604090206001015490565b6101ec6102283660046110ca565b61050b565b6101ec61023b3660046110ca565b610536565b6101cb60025481565b6101cb7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b61028361027e3660046110ed565b61058f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161019b565b61018f6102b63660046110ca565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b6101cb7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6101cb600081565b6101ec6103293660046110b1565b6105ae565b6101ec61033c3660046110b1565b610690565b6101cb620f424081565b6101cb6103593660046110b1565b6106f8565b6101cb7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b6101ec6103933660046110ca565b61070f565b6101cb6103a636600461110f565b60036020526000908152604090205481565b6101cb60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610417575061041782610734565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610447816107cb565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120549081900361047b5750505050565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408120556104ac9084836107d8565b6040805173ffffffffffffffffffffffffffffffffffffffff8087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b600082815260208190526040902060010154610526816107cb565b610530838361092f565b50505050565b73ffffffffffffffffffffffffffffffffffffffff81163314610585576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105068282610964565b60008281526001602052604081206105a79083610991565b9392505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556105d8816107cb565b612710821115610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556106ba816107cb565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101610683565b60008181526001602052604081206104179061099d565b60008281526020819052604090206001015461072a816107cb565b6105308383610964565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061041757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610417565b6107d581336109a7565b50565b3073ffffffffffffffffffffffffffffffffffffffff8316036107fa57505050565b8060000361080757505050565b7fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff84160161090e5760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d806000811461089e576040519150601f19603f3d011682016040523d82523d6000602084013e6108a3565b606091505b5050905080610530576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610640565b61050673ffffffffffffffffffffffffffffffffffffffff84168383610a31565b60008061093c8484610abe565b905080156105a757600084815260016020526040902061095c9084610bba565b509392505050565b6000806109718484610bdc565b905080156105a757600084815260016020526040902061095c9084610c97565b60006105a78383610cb9565b6000610417825490565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610a2d576040517fe2517d3f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052604401610640565b5050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610506908490610ce3565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff16610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff86168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610b503390565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610417565b506000610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610d79565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915281205460ff1615610bb25760008381526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610417565b60006105a78373ffffffffffffffffffffffffffffffffffffffff8416610dc0565b6000826000018281548110610cd057610cd061112a565b9060005260206000200154905092915050565b6000610d0573ffffffffffffffffffffffffffffffffffffffff841683610eb3565b90508051600014158015610d2a575080806020019051810190610d289190611159565b155b15610506576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610640565b6000818152600183016020526040812054610bb257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610417565b60008181526001830160205260408120548015610ea9576000610de460018361117b565b8554909150600090610df89060019061117b565b9050808214610e5d576000866000018281548110610e1857610e1861112a565b9060005260206000200154905080876000018481548110610e3b57610e3b61112a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e6e57610e6e6111b5565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610417565b6000915050610417565b60606105a783836000846000808573ffffffffffffffffffffffffffffffffffffffff168486604051610ee691906111e4565b60006040518083038185875af1925050503d8060008114610f23576040519150601f19603f3d011682016040523d82523d6000602084013e610f28565b606091505b5091509150610f38868383610f42565b9695505050505050565b606082610f5757610f5282610fd1565b6105a7565b8151158015610f7b575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610fca576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610640565b50806105a7565b805115610fe15780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020828403121561102557600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105a757600080fd5b803573ffffffffffffffffffffffffffffffffffffffff8116811461107957600080fd5b919050565b6000806040838503121561109157600080fd5b61109a83611055565b91506110a860208401611055565b90509250929050565b6000602082840312156110c357600080fd5b5035919050565b600080604083850312156110dd57600080fd5b823591506110a860208401611055565b6000806040838503121561110057600080fd5b50508035926020909101359150565b60006020828403121561112157600080fd5b6105a782611055565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561116b57600080fd5b815180151581146105a757600080fd5b81810381811115610417577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000825160005b8181101561120557602081860181015185830152016111eb565b50600092019182525091905056fea2646970667358221220b13443229221519c0fdb3ac2db22c34ccdfff8fd9f142c9a058dcefb00a5a9d864736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"62810:1843:0:-:0;;;63637:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;63675:38;52847:4;63706:6;63675:10;:38::i;:::-;;63637:83;62810:1843;;62160:257;62246:4;;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62318:69;62403:7;-1:-1:-1;62160:257:0;;;;;:::o;56794:316::-;56871:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;-1:-1:-1;;;;;56930:29:0;;;;;;;;;:36;;-1:-1:-1;;56930:36:0;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;-1:-1:-1;;;;;56985:40:0;57003:7;-1:-1:-1;;;;;56985:40:0;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;-1:-1:-1;;;;;32931:23:0;;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;14:290:1;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:1;;214:42;;204:70;;270:1;267;260:12;14:290;62810:1843:0;;;;;;","srcMapRuntime":"62810:1843:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60820:212;;;;;;:::i;:::-;;:::i;:::-;;;516:14:1;;509:22;491:41;;479:2;464:18;60820:212:0;;;;;;;;63050:60;;63087:23;63050:60;;;;;689:25:1;;;677:2;662:18;63050:60:0;543:177:1;64022:359:0;;;;;;:::i;:::-;;:::i;:::-;;63232:45;;63271:6;63232:45;;54425:120;;;;;;:::i;:::-;54490:7;54516:12;;;;;;;;;;:22;;;;54425:120;54841:136;;;;;;:::i;:::-;;:::i;55943:245::-;;;;;;:::i;:::-;;:::i;63394:30::-;;;;;;62978:66;;63018:26;62978:66;;61617:142;;;;;;:::i;:::-;;:::i;:::-;;;2246:42:1;2234:55;;;2216:74;;2204:2;2189:18;61617:142:0;2070:226:1;53469:136:0;;;;;;:::i;:::-;53546:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;;;;53469:136;62908:64;;62947:25;62908:64;;52802:49;;52847:4;52802:49;;63726:290;;;;;;:::i;:::-;;:::i;64387:264::-;;;;;;:::i;:::-;;:::i;63189:37::-;;63223:3;63189:37;;61927:131;;;;;;:::i;:::-;;:::i;63116:66::-;;63156:26;63116:66;;55257:138;;;;;;:::i;:::-;;:::i;63480:47::-;;;;;;:::i;:::-;;;;;;;;;;;;;;63601:29;;;;;;60820:212;60905:4;60928:57;;;60943:42;60928:57;;:97;;;60989:36;61013:11;60989:23;:36::i;:::-;60921:104;60820:212;-1:-1:-1;;60820:212:0:o;64022:359::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;64146:19:::1;::::0;::::1;64126:17;64146:19:::0;;;:12:::1;:19;::::0;;;;;;64179:14;;;64175:27:::1;;64195:7;64022:359:::0;;;:::o;64175:27::-:1;64243:19;::::0;::::1;64265:1;64243:19:::0;;;:12:::1;:19;::::0;;;;:23;64276:45:::1;::::0;64300:9;64311;64276:23:::1;:45::i;:::-;64336:38;::::0;;2889:42:1;2958:15;;;2940:34;;3010:15;;3005:2;2990:18;;2983:43;3042:18;;;3035:34;;;64336:38:0::1;::::0;2867:2:1;2852:18;64336:38:0::1;;;;;;;64116:265;53105:1;64022:359:::0;;;:::o;54841:136::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;54945:25:::1;54956:4;54962:7;54945:10;:25::i;:::-;;54841:136:::0;;;:::o;55943:245::-;56036:34;;;23368:10;56036:34;56032:102;;56093:30;;;;;;;;;;;;;;56032:102;56144:37;56156:4;56162:18;56144:11;:37::i;61617:142::-;61698:7;61724:18;;;:12;:18;;;;;:28;;61746:5;61724:21;:28::i;:::-;61717:35;61617:142;-1:-1:-1;;;61617:142:0:o;63726:290::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;63271:6:::1;63825:10;:26;;63817:55;;;::::0;::::1;::::0;;3282:2:1;63817:55:0::1;::::0;::::1;3264:21:1::0;3321:2;3301:18;;;3294:30;3360:18;3340;;;3333:46;3396:18;;63817:55:0::1;;;;;;;;;63903:15;::::0;;63928:28;;;;63971:38:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;63971:38:0::1;::::0;3572:18:1;63971:38:0::1;;;;;;;;63807:209;63726:290:::0;;:::o;64387:264::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;64512:14:::1;::::0;;64536:34;;;;64585:59:::1;::::0;;3599:25:1;;;3655:2;3640:18;;3633:34;;;64585:59:0::1;::::0;3572:18:1;64585:59:0::1;3425:248:1::0;61927:131:0;61998:7;62024:18;;;:12;:18;;;;;:27;;:25;:27::i;55257:138::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;55362:26:::1;55374:4;55380:7;55362:11;:26::i;53180:202::-:0;53265:4;53288:47;;;53303:32;53288:47;;:87;;-1:-1:-1;45095:25:0;45080:40;;;;53339:36;44981:146;53814:103;53880:30;53891:4;23368:10;53880;:30::i;:::-;53814:103;:::o;58092:653::-;58267:4;58253:19;;;;58249:32;;58092:653;;;:::o;58249:32::-;58353:5;58362:1;58353:10;58349:23;;58092:653;;;:::o;58349:23::-;58385:20;;;;;58381:358;;58565:12;58582:2;:7;;58597:5;58582:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;58564:43;;;58629:7;58621:39;;;;;;;4090:2:1;58621:39:0;;;4072:21:1;4129:2;4109:18;;;4102:30;4168:21;4148:18;;;4141:49;4207:18;;58621:39:0;3888:343:1;58381:358:0;58691:37;:26;;;58718:2;58722:5;58691:26;:37::i;62160:257::-;62246:4;62262:12;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62403:7;62160:257;-1:-1:-1;;;62160:257:0:o;62520:262::-;62607:4;62623:12;62638:32;62656:4;62662:7;62638:17;:32::i;:::-;62623:47;;62684:7;62680:72;;;62707:18;;;;:12;:18;;;;;:34;;62733:7;62707:25;:34::i;34071:156::-;34145:7;34195:22;34199:3;34211:5;34195:3;:22::i;33614:115::-;33677:7;33703:19;33711:3;29053:18;;28971:107;54047:197;53546:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;54130:108;;54180:47;;;;;4440:42:1;4428:55;;54180:47:0;;;4410:74:1;4500:18;;;4493:34;;;4383:18;;54180:47:0;4236:297:1;54130:108:0;54047:197;;:::o;46297:160::-;46406:43;;;46421:14;4428:55:1;;46406:43:0;;;4410:74:1;4500:18;;;;4493:34;;;46406:43:0;;;;;;;;;;4383:18:1;;;;46406:43:0;;;;;;;;;;;;;;46379:71;;46399:5;;46379:19;:71::i;56794:316::-;56871:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;:29;;;;;;;;;;:36;;;;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;56985:40;;57003:7;56985:40;;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;32931:23;;;32906:4;:50::i;57345:317::-;57423:4;53569:12;;;;;;;;;;;:29;;;;;;;;;;;;;57439:217;;;57513:5;57481:12;;;;;;;;;;;:29;;;;;;;;;;;:37;;;;;;57537:40;23368:10;;57481:12;;57537:40;;57513:5;57537:40;-1:-1:-1;57598:4:0;57591:11;;33131:156;33204:4;33227:53;33235:3;33255:23;;;33227:7;:53::i;29420:118::-;29487:7;29513:3;:11;;29525:5;29513:18;;;;;;;;:::i;:::-;;;;;;;;;29506:25;;29420:118;;;;:::o;49053:629::-;49472:23;49498:33;:27;;;49526:4;49498:27;:33::i;:::-;49472:59;;49545:10;:17;49566:1;49545:22;;:57;;;;;49583:10;49572:30;;;;;;;;;;;;:::i;:::-;49571:31;49545:57;49541:135;;;49625:40;;;;;2246:42:1;2234:55;;49625:40:0;;;2216:74:1;2189:18;;49625:40:0;2070:226:1;26738:406:0;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;27312:1368;27378:4;27507:21;;;:14;;;:21;;;;;;27543:13;;27539:1135;;27910:18;27931:12;27942:1;27931:8;:12;:::i;:::-;27977:18;;27910:33;;-1:-1:-1;27957:17:0;;27977:22;;27998:1;;27977:22;:::i;:::-;27957:42;;28032:9;28018:10;:23;28014:378;;28061:17;28081:3;:11;;28093:9;28081:22;;;;;;;;:::i;:::-;;;;;;;;;28061:42;;28228:9;28202:3;:11;;28214:10;28202:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;28341:25;;;:14;;;:25;;;;;:36;;;28014:378;28470:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;28573:3;:14;;:21;28588:5;28573:21;;;;;;;;;;;28566:28;;;28616:4;28609:11;;;;;;;27539:1135;28658:5;28651:12;;;;;19074:151;19149:12;19180:38;19202:6;19210:4;19216:1;19149:12;19790;19804:23;19831:6;:11;;19850:5;19857:4;19831:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19789:73;;;;19879:55;19906:6;19914:7;19923:10;19879:26;:55::i;:::-;19872:62;19549:392;-1:-1:-1;;;;;;19549:392:0:o;20994:582::-;21138:12;21167:7;21162:408;;21190:19;21198:10;21190:7;:19::i;:::-;21162:408;;;21414:17;;:22;:49;;;;-1:-1:-1;21440:18:0;;;;:23;21414:49;21410:119;;;21490:24;;;;;2246:42:1;2234:55;;21490:24:0;;;2216:74:1;2189:18;;21490:24:0;2070:226:1;21410:119:0;-1:-1:-1;21549:10:0;21542:17;;22112:516;22243:17;;:21;22239:383;;22471:10;22465:17;22527:15;22514:10;22510:2;22506:19;22499:44;22239:383;22594:17;;;;;;;;;;;;;;14:332:1;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;180:9;167:23;230:66;223:5;219:78;212:5;209:89;199:117;;312:1;309;302:12;725:196;793:20;;853:42;842:54;;832:65;;822:93;;911:1;908;901:12;822:93;725:196;;;:::o;926:260::-;994:6;1002;1055:2;1043:9;1034:7;1030:23;1026:32;1023:52;;;1071:1;1068;1061:12;1023:52;1094:29;1113:9;1094:29;:::i;:::-;1084:39;;1142:38;1176:2;1165:9;1161:18;1142:38;:::i;:::-;1132:48;;926:260;;;;;:::o;1373:180::-;1432:6;1485:2;1473:9;1464:7;1460:23;1456:32;1453:52;;;1501:1;1498;1491:12;1453:52;-1:-1:-1;1524:23:1;;1373:180;-1:-1:-1;1373:180:1:o;1558:254::-;1626:6;1634;1687:2;1675:9;1666:7;1662:23;1658:32;1655:52;;;1703:1;1700;1693:12;1655:52;1739:9;1726:23;1716:33;;1768:38;1802:2;1791:9;1787:18;1768:38;:::i;1817:248::-;1885:6;1893;1946:2;1934:9;1925:7;1921:23;1917:32;1914:52;;;1962:1;1959;1952:12;1914:52;-1:-1:-1;;1985:23:1;;;2055:2;2040:18;;;2027:32;;-1:-1:-1;1817:248:1:o;2486:186::-;2545:6;2598:2;2586:9;2577:7;2573:23;2569:32;2566:52;;;2614:1;2611;2604:12;2566:52;2637:29;2656:9;2637:29;:::i;4840:184::-;4892:77;4889:1;4882:88;4989:4;4986:1;4979:15;5013:4;5010:1;5003:15;5029:277;5096:6;5149:2;5137:9;5128:7;5124:23;5120:32;5117:52;;;5165:1;5162;5155:12;5117:52;5197:9;5191:16;5250:5;5243:13;5236:21;5229:5;5226:32;5216:60;;5272:1;5269;5262:12;5311:282;5378:9;;;5399:11;;;5396:191;;;5443:77;5440:1;5433:88;5544:4;5541:1;5534:15;5572:4;5569:1;5562:15;5598:184;5650:77;5647:1;5640:88;5747:4;5744:1;5737:15;5771:4;5768:1;5761:15;5787:412;5916:3;5954:6;5948:13;5979:1;5989:129;6003:6;6000:1;5997:13;5989:129;;;6101:4;6085:14;;;6081:25;;6075:32;6062:11;;;6055:53;6018:12;5989:129;;;-1:-1:-1;6173:1:1;6137:16;;6162:13;;;-1:-1:-1;6137:16:1;5787:412;-1:-1:-1;5787:412:1:o","abiDefinition":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldChainGasAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"ChainGasAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesSwept","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RATE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARD_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFUNDER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainGasAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"protocolFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"setChainGasAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"setProtocolFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{"chainGasAmount()":{"notice":"Chain gas amount to forward as rebate if requested"},"protocolFeeRate()":{"notice":"Protocol fee rate taken on origin amount deposited in origin chain"},"protocolFees(address)":{"notice":"Protocol fee amounts accumulated"}},"version":1},"developerDoc":{"errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}],"AddressEmptyCode(address)":[{"details":"There's no code at `target` (it is not a contract)."}],"AddressInsufficientBalance(address)":[{"details":"The ETH balance of the account is not enough to perform the operation."}],"FailedInnerCall()":[{"details":"A call to an address target failed. The target may have reverted."}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC20 token failed."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldChainGasAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"ChainGasAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldFeeRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"FeeRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FeesSwept\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_BPS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_RATE_MAX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOVERNOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GUARD_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REFUNDER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"chainGasAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"protocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"setChainGasAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"sweepProtocolFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}],\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"chainGasAmount()\":{\"notice\":\"Chain gas amount to forward as rebate if requested\"},\"protocolFeeRate()\":{\"notice\":\"Protocol fee rate taken on origin amount deposited in origin chain\"},\"protocolFees(address)\":{\"notice\":\"Protocol fee amounts accumulated\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"Admin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","REFUNDER_ROLE()":"5960ccf2","RELAYER_ROLE()":"926d7d7f","chainGasAmount()":"e00a83e0","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","protocolFeeRate()":"58f85880","protocolFees(address)":"dcf844a7","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeV2.sol:Context":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.","kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"Context\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:ERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ```","kind":"dev","methods":{"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example: ```solidity function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); } ```\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"ERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:EnumerableSet":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122096938e347a6ad7c9db19e62e3fe085fcb6b4b02d667bfa2b5db09e30538dd3cd64736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122096938e347a6ad7c9db19e62e3fe085fcb6b4b02d667bfa2b5db09e30538dd3cd64736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"25827:11640:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;25827:11640:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"25827:11640:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Library for managing https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive types. Sets have the following properties: - Elements are added, removed, and checked for existence in constant time (O(1)). - Elements are enumerated in O(n). No guarantees are made on the ordering. ```solidity contract Example { // Add the library methods using EnumerableSet for EnumerableSet.AddressSet; // Declare a set state variable EnumerableSet.AddressSet private mySet; } ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) and `uint256` (`UintSet`) are supported. [WARNING] ==== Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. ====","kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Library for managing https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive types. Sets have the following properties: - Elements are added, removed, and checked for existence in constant time (O(1)). - Elements are enumerated in O(n). No guarantees are made on the ordering. ```solidity contract Example { // Add the library methods using EnumerableSet for EnumerableSet.AddressSet; // Declare a set state variable EnumerableSet.AddressSet private mySet; } ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) and `uint256` (`UintSet`) are supported. [WARNING] ==== Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. ====\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"EnumerableSet\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:FastBridgeV2":{"code":"0x60c060405260006080523480156200001657600080fd5b5060405162003e6138038062003e61833981016040819052620000399162000199565b806200004760008262000054565b50504360a05250620001c4565b60008062000063848462000091565b90508015620000885760008481526001602052604090206200008690846200013f565b505b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000136576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000ed3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016200008b565b5060006200008b565b600062000088836001600160a01b038416600081815260018301602052604081205462000136575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200008b565b600060208284031215620001ac57600080fd5b81516001600160a01b03811681146200008857600080fd5b60805160a051613c77620001ea6000396000610802015260006108a30152613c776000f3fe6080604052600436106102fd5760003560e01c806391ad50391161018f578063b13aa2d6116100e1578063ca15c8731161008a578063dcf844a711610064578063dcf844a714610a50578063df36bb1314610a7d578063e00a83e014610a9357600080fd5b8063ca15c873146109dc578063ccc57490146109fc578063d547741f14610a3057600080fd5b8063bfc7c607116100bb578063bfc7c6071461091c578063c63ff8dd1461092f578063c79371b11461094f57600080fd5b8063b13aa2d6146108c5578063b250fe6b146108e5578063bf333f2c1461090557600080fd5b8063a3ec191a11610143578063ac11fb1a1161011d578063ac11fb1a14610844578063add98c7014610871578063affed0e01461089157600080fd5b8063a3ec191a146107f0578063a5bbe22b14610607578063aa9641ab1461082457600080fd5b8063926d7d7f11610174578063926d7d7f146107945780639c9545f0146107c8578063a217fddf146107db57600080fd5b806391ad5039146106d057806391d148541461075057600080fd5b806341fcb6121161025357806363787e52116101fc578063886d36ff116101d6578063886d36ff146106655780638f0d6f17146106855780639010d07c1461069857600080fd5b806363787e521461058c578063820688d5146106075780638379a24f1461061d57600080fd5b80635960ccf21161022d5780635960ccf21461050b5780635aa6ccba1461053f5780635eb7d9461461056c57600080fd5b806341fcb612146104c257806345851694146104e257806358f85880146104f557600080fd5b806318e4357d116102b5578063295710ff1161028f578063295710ff146104555780632f2ff15d1461048257806336568abe146104a257600080fd5b806318e4357d146103ee578063190da5951461040e578063248a9ca31461042557600080fd5b8063051287bc116102e6578063051287bc1461037957806306f333f2146103b65780630f5f6ed7146103d857600080fd5b806301ffc9a71461030257806303ed0ee514610337575b600080fd5b34801561030e57600080fd5b5061032261031d366004612eef565b610aa9565b60405190151581526020015b60405180910390f35b34801561034357600080fd5b5061036b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161032e565b34801561038557600080fd5b506103a9610394366004612f31565b60009081526005602052604090205460ff1690565b60405161032e9190612fb4565b3480156103c257600080fd5b506103d66103d1366004612fe2565b610b05565b005b3480156103e457600080fd5b5061036b61271081565b3480156103fa57600080fd5b506103d661040936600461301b565b610bcc565b34801561041a57600080fd5b5061036b62093a8081565b34801561043157600080fd5b5061036b610440366004612f31565b60009081526020819052604090206001015490565b34801561046157600080fd5b5061036b610470366004613054565b60076020526000908152604090205481565b34801561048e57600080fd5b506103d661049d366004613071565b610d39565b3480156104ae57600080fd5b506103d66104bd366004613071565b610d64565b3480156104ce57600080fd5b506103d66104dd366004613209565b610db0565b6103d66104f0366004613329565b611026565b34801561050157600080fd5b5061036b60025481565b34801561051757600080fd5b5061036b7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561054b57600080fd5b5061055f61055a366004613346565b611083565b60405161032e91906133d3565b34801561057857600080fd5b506103d6610587366004613346565b611149565b34801561059857600080fd5b506105f76105a7366004612f31565b60056020526000908152604090205460ff811690610100810464ffffffffff16906601000000000000810465ffffffffffff16906c0100000000000000000000000090046001600160a01b031684565b60405161032e94939291906134e8565b34801561061357600080fd5b5061036b61070881565b34801561062957600080fd5b50610322610638366004612f31565b6000908152600660205260409020546c0100000000000000000000000090046001600160a01b0316151590565b34801561067157600080fd5b506103d6610680366004613529565b61133e565b6103d6610693366004613346565b611354565b3480156106a457600080fd5b506106b86106b336600461356e565b61135e565b6040516001600160a01b03909116815260200161032e565b3480156106dc57600080fd5b506107246106eb366004612f31565b600090815260056020526040902054610100810464ffffffffff16916c010000000000000000000000009091046001600160a01b031690565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161032e565b34801561075c57600080fd5b5061032261076b366004613071565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156107a057600080fd5b5061036b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6103d66107d6366004613209565b61137d565b3480156107e757600080fd5b5061036b600081565b3480156107fc57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561083057600080fd5b5061032261083f366004613071565b611603565b34801561085057600080fd5b5061086461085f366004613346565b6116ee565b60405161032e9190613590565b34801561087d57600080fd5b506103d661088c366004612f31565b6118a6565b34801561089d57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156108d157600080fd5b506103d66108e0366004612f31565b6119c8565b3480156108f157600080fd5b506103d6610900366004612f31565b611aaa565b34801561091157600080fd5b5061036b620f424081565b6103d661092a366004613676565b611b12565b34801561093b57600080fd5b506103d661094a366004613346565b611d94565b34801561095b57600080fd5b506109ae61096a366004612f31565b60066020526000908152604090205465ffffffffffff8082169166010000000000008104909116906c0100000000000000000000000090046001600160a01b031683565b6040805165ffffffffffff94851681529390921660208401526001600160a01b03169082015260600161032e565b3480156109e857600080fd5b5061036b6109f7366004612f31565b611d9f565b348015610a0857600080fd5b5061036b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b348015610a3c57600080fd5b506103d6610a4b366004613071565b611db6565b348015610a5c57600080fd5b5061036b610a6b366004613054565b60036020526000908152604090205481565b348015610a8957600080fd5b5061036b61ffff81565b348015610a9f57600080fd5b5061036b60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610aff5750610aff82611ddb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b2f81611e72565b6001600160a01b03831660009081526003602052604081205490819003610b565750505050565b6001600160a01b038416600081815260036020526040812055610b7a908483611e7c565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610bf681611e72565b600160008581526005602052604090205460ff166004811115610c1b57610c1b612f4a565b14610c52576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260056020908152604091829020805460027fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009091166101004264ffffffffff16027fffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffff161766010000000000004365ffffffffffff160217176bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0387169081029190911790915582518681529251909287927f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e492918290030190a350505050565b600082815260208190526040902060010154610d5481611e72565b610d5e8383611f9f565b50505050565b6001600160a01b0381163314610da6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bc78282611fd4565b815160208301206000610dc284611083565b9050600260008381526005602052604090205460ff166004811115610de957610de9612f4a565b14610e20576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316610e5d576000828152600560205260409020546c0100000000000000000000000090046001600160a01b03169250610ebd565b6000828152600560205260409020546c0100000000000000000000000090046001600160a01b03163314610ebd576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611610f18576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905561010081015115610f925761010081015160808201516001600160a01b031660009081526003602052604081208054909190610f8c908490613773565b90915550505b608081015160c0820151610fb06001600160a01b0383168683611e7c565b6000848152600560209081526040918290205482516001600160a01b038681168252928101859052888316936c010000000000000000000000009092049092169187917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac678910160405180910390a4505050505050565b611080816040518060a0016040528060006001600160a01b03168152602001600081526020016040518060200160405280600081525081526020016000815260200160405180602001604052806000815250815250611b12565b50565b611135604051806101e00160405280600063ffffffff168152602001600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001606081525090565b81806020019051810190610aff91906137e1565b80516020820120600061115b83611083565b9050600160008381526005602052604090205460ff16600481111561118257611182612f4a565b146111b9576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205460ff161561123357806101400151421161122e576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127f565b62093a808161014001516112479190613773565b421161127f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166004179055820151608083015161010084015160c0850151929391926112d89190613773565b90506112ee6001600160a01b0383168483611e7c565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b61135082805190602001208233610bcc565b5050565b611080813361137d565b60008281526001602052604081206113769083612001565b9392505050565b81516020830120600061138f84611083565b905061139c81838561200d565b604080516060808201835265ffffffffffff438116835242811660208085019182526001600160a01b0389811686880181815260008b815260068552899020975188549551915184166c01000000000000000000000000026bffffffffffffffffffffffff9288166601000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090971691909716179490941793909316939093179094558583015160a08088015160e08901516101208a01518a516080808d015160c0808f01518e5163ffffffff9095168552918b169c84019c909c52858a169c83019c909c529881019a909a52968901819052918801869052919691959094938716929189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c910160405180910390a47fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161157957801561153b576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b813414611574576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115c7565b8034146115b2576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115c76001600160a01b0384163386856121aa565b6101c085015151156115e9576115e4848484886101c00151612226565b6115f9565b34156115f9576115f98434612385565b5050505050505050565b6000600260008481526005602052604090205460ff16600481111561162a5761162a612f4a565b14611661576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020546001600160a01b038381166c0100000000000000000000000090920416146116c4576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060009081526005602052604090205461070861010090910464ffffffffff9081164203161190565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820181905261016082015290517f5aa6ccba0000000000000000000000000000000000000000000000000000000081523090635aa6ccba90611787908590600401613916565b600060405180830381865afa9250505080156117c557506040513d6000823e601f3d908101601f191682016040526117c291908101906137e1565b60015b6117dd5781806020019051810190610aff9190613934565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff16815260200182604001516001600160a01b0316815260200182606001516001600160a01b0316815260200182608001516001600160a01b031681526020018260a001516001600160a01b031681526020018260c0015181526020018260e001518152602001826101000151815260200182610120015160001415151581526020018261014001518152602001826101600151815250915050919050565b919050565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6118d081611e72565b600260008381526005602052604090205460ff1660048111156118f5576118f5612f4a565b1461192c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff9081164203161115611988576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560205260408082206001905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556119f281611e72565b612710821115611a63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611ad481611e72565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101611a9d565b6000816020015142611b249190613a00565b9050611b3183838361244e565b6000611b4584606001518560a001516126d3565b90506000806002541115611b7257620f424060025483611b659190613a28565b611b6f9190613a3f565b90505b611b7c8183613a7a565b91506000604051806101e001604052804663ffffffff168152602001876000015163ffffffff16815260200187602001516001600160a01b0316815260200187604001516001600160a01b0316815260200187606001516001600160a01b0316815260200187608001516001600160a01b031681526020018481526020018760c0015181526020018381526020018660600151815260200187610100015181526020016007600089602001516001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190611c5990613a8d565b91905055815260200186600001516001600160a01b031681526020018581526020018660800151815250604051602001611c9391906133d3565b60408051808303601f1901815282825280516020808301919091206000818152600583529390932080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905589015189516060808c015160808d015160c08e0151928d015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95611d47958b95909493928e9290151590613ac5565b60405180910390a3807f3120e2bb59c86aca6890191a589a96af3662838efa374fbdcdf4c95bfe4a6c0e8760400151604051611d839190613916565b60405180910390a250505050505050565b611080816000610db0565b6000818152600160205260408120610aff906128b4565b600082815260208190526040902060010154611dd181611e72565b610d5e8383611fd4565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aff57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610aff565b61108081336128be565b306001600160a01b03831603611e9157505050565b80600003611e9e57505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611f8b576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f1b576040519150601f19603f3d011682016040523d82523d6000602084013e611f20565b606091505b5050905080610d5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401611a5a565b610bc76001600160a01b038416838361292a565b600080611fac848461295b565b90508015611376576000848152600160205260409020611fcc9084612a23565b509392505050565b600080611fe18484612a38565b90508015611376576000848152600160205260409020611fcc9084612ad9565b60006113768383612aee565b6001600160a01b03811661204d576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660205260409020546c0100000000000000000000000090046001600160a01b0316156120ac576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836020015163ffffffff16146120ef576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82610140015142111561212e576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101808301516001600160a01b0316158015906121625750806001600160a01b03168361018001516001600160a01b031614155b80156121735750826101a001514211155b15610bc7576040517f14be123200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610d5e9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b18565b600083838360405160240161223d93929190613b1b565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f461e0c2100000000000000000000000000000000000000000000000000000000179052905060006122a4868334612b94565b905080516000036122e1576040517f1a95ad2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160201461231c576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f461e0c210000000000000000000000000000000000000000000000000000000061234682613b4c565b1461237d576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b804710156123c1576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a5a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461240e576040519150601f19603f3d011682016040523d82523d6000602084013e612413565b606091505b5050905080610bc7576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836000015163ffffffff1603612491576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a083015115806124a4575060c0830151155b156124db576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208301516001600160a01b03161580612500575060408301516001600160a01b0316155b15612537576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301516001600160a01b0316158061255c575060808301516001600160a01b0316155b15612593576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61259f61070842613773565b83610100015110156125dd576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff826080015151111561261e576040517ffbe24d4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082015115801590612651575060808301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15612688576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008113158061269c575082610100015181135b15610bc7576040517f352807b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016127455734821461273e576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5034610aff565b612757836001600160a01b0316612c4a565b341561278f576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa1580156127ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128109190613b91565b90506128276001600160a01b0384163330856121aa565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa158015612886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128aa9190613b91565b6113769190613a7a565b6000610aff825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611350576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401611a5a565b6040516001600160a01b03838116602483015260448201839052610bc791859182169063a9059cbb906064016121df565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16612a1b576000838152602081815260408083206001600160a01b0386168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556129d33390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610aff565b506000610aff565b6000611376836001600160a01b038416612cf0565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615612a1b576000838152602081815260408083206001600160a01b038616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610aff565b6000611376836001600160a01b038416612d37565b6000826000018281548110612b0557612b05613baa565b9060005260206000200154905092915050565b6000612b2d6001600160a01b03841683612e2a565b90508051600014158015612b52575080806020019051810190612b509190613bd9565b155b15610bc7576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401611a5a565b606081471015612bd2576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a5a565b600080856001600160a01b03168486604051612bee9190613bf6565b60006040518083038185875af1925050503d8060008114612c2b576040519150601f19603f3d011682016040523d82523d6000602084013e612c30565b606091505b5091509150612c40868383612e38565b9695505050505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612cac576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b600003611080576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600183016020526040812054612a1b57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aff565b60008181526001830160205260408120548015612e20576000612d5b600183613a7a565b8554909150600090612d6f90600190613a7a565b9050808214612dd4576000866000018281548110612d8f57612d8f613baa565b9060005260206000200154905080876000018481548110612db257612db2613baa565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612de557612de5613c12565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aff565b6000915050610aff565b606061137683836000612b94565b606082612e4d57612e4882612ead565b611376565b8151158015612e6457506001600160a01b0384163b155b15612ea6576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401611a5a565b5080611376565b805115612ebd5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612f0157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461137657600080fd5b600060208284031215612f4357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60058110612fb0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610aff8284612f79565b6001600160a01b038116811461108057600080fd5b80356118a181612fc2565b60008060408385031215612ff557600080fd5b823561300081612fc2565b9150602083013561301081612fc2565b809150509250929050565b60008060006060848603121561303057600080fd5b8335925060208401359150604084013561304981612fc2565b809150509250925092565b60006020828403121561306657600080fd5b813561137681612fc2565b6000806040838503121561308457600080fd5b82359150602083013561301081612fc2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff811182821017156130e9576130e9613096565b60405290565b60405160a0810167ffffffffffffffff811182821017156130e9576130e9613096565b6040516101e0810167ffffffffffffffff811182821017156130e9576130e9613096565b604051610180810167ffffffffffffffff811182821017156130e9576130e9613096565b604051601f8201601f1916810167ffffffffffffffff8111828210171561318357613183613096565b604052919050565b600067ffffffffffffffff8211156131a5576131a5613096565b50601f01601f191660200190565b600082601f8301126131c457600080fd5b81356131d76131d28261318b565b61315a565b8181528460208386010111156131ec57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561321c57600080fd5b823567ffffffffffffffff81111561323357600080fd5b61323f858286016131b3565b925050602083013561301081612fc2565b63ffffffff8116811461108057600080fd5b80356118a181613250565b801515811461108057600080fd5b80356118a18161326d565b6000610120828403121561329957600080fd5b6132a16130c5565b90506132ac82613262565b81526132ba60208301612fd7565b60208201526132cb60408301612fd7565b60408201526132dc60608301612fd7565b60608201526132ed60808301612fd7565b608082015260a082013560a082015260c082013560c082015261331260e0830161327b565b60e082015261010080830135818301525092915050565b6000610120828403121561333c57600080fd5b6113768383613286565b60006020828403121561335857600080fd5b813567ffffffffffffffff81111561336f57600080fd5b61337b848285016131b3565b949350505050565b60005b8381101561339e578181015183820152602001613386565b50506000910152565b600081518084526133bf816020860160208601613383565b601f01601f19169290920160200192915050565b602081526133ea60208201835163ffffffff169052565b60006020830151613403604084018263ffffffff169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a06134c1818501836001600160a01b03169052565b8401516101c0848101919091528401516101e080850152905061337b6102008401826133a7565b608081016134f68287612f79565b64ffffffffff8516602083015265ffffffffffff841660408301526001600160a01b038316606083015295945050505050565b6000806040838503121561353c57600080fd5b823567ffffffffffffffff81111561355357600080fd5b61355f858286016131b3565b95602094909401359450505050565b6000806040838503121561358157600080fd5b50508035926020909101359150565b815163ffffffff168152610180810160208301516135b6602084018263ffffffff169052565b5060408301516135d160408401826001600160a01b03169052565b5060608301516135ec60608401826001600160a01b03169052565b50608083015161360760808401826001600160a01b03169052565b5060a083015161362260a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516136578285018215159052565b5050610140838101519083015261016092830151929091019190915290565b600080610140838503121561368a57600080fd5b6136948484613286565b915061012083013567ffffffffffffffff808211156136b257600080fd5b9084019060a082870312156136c657600080fd5b6136ce6130ef565b82356136d981612fc2565b8152602083810135908201526040830135828111156136f757600080fd5b613703888286016131b3565b6040830152506060830135606082015260808301358281111561372557600080fd5b613731888286016131b3565b6080830152508093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610aff57610aff613744565b80516118a181613250565b80516118a181612fc2565b600082601f8301126137ad57600080fd5b81516137bb6131d28261318b565b8181528460208386010111156137d057600080fd5b61337b826020830160208701613383565b6000602082840312156137f357600080fd5b815167ffffffffffffffff8082111561380b57600080fd5b908301906101e0828603121561382057600080fd5b613828613112565b61383183613786565b815261383f60208401613786565b602082015261385060408401613791565b604082015261386160608401613791565b606082015261387260808401613791565b608082015261388360a08401613791565b60a082015260c0838101519082015260e0808401519082015261010080840151908201526101208084015190820152610140808401519082015261016080840151908201526101806138d6818501613791565b908201526101a083810151908201526101c080840151838111156138f957600080fd5b6139058882870161379c565b918301919091525095945050505050565b60208152600061137660208301846133a7565b80516118a18161326d565b6000610180828403121561394757600080fd5b61394f613136565b61395883613786565b815261396660208401613786565b602082015261397760408401613791565b604082015261398860608401613791565b606082015261399960808401613791565b60808201526139aa60a08401613791565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206139dd818501613929565b908201526101408381015190820152610160928301519281019290925250919050565b8082018281126000831280158216821582161715613a2057613a20613744565b505092915050565b8082028115828204841417610aff57610aff613744565b600082613a75577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610aff57610aff613744565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613abe57613abe613744565b5060010190565b60e081526000613ad860e083018a6133a7565b63ffffffff989098166020830152506001600160a01b039586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b6001600160a01b0384168152826020820152606060408201526000613b4360608301846133a7565b95945050505050565b80516020808301519190811015613b8b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b600060208284031215613ba357600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613beb57600080fd5b81516113768161326d565b60008251613c08818460208701613383565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220fef42b85b97e95ca087836390d97d99307ec60b38cd20d26ea0f113c18a0660d64736f6c63430008180033","runtime-code":"0x6080604052600436106102fd5760003560e01c806391ad50391161018f578063b13aa2d6116100e1578063ca15c8731161008a578063dcf844a711610064578063dcf844a714610a50578063df36bb1314610a7d578063e00a83e014610a9357600080fd5b8063ca15c873146109dc578063ccc57490146109fc578063d547741f14610a3057600080fd5b8063bfc7c607116100bb578063bfc7c6071461091c578063c63ff8dd1461092f578063c79371b11461094f57600080fd5b8063b13aa2d6146108c5578063b250fe6b146108e5578063bf333f2c1461090557600080fd5b8063a3ec191a11610143578063ac11fb1a1161011d578063ac11fb1a14610844578063add98c7014610871578063affed0e01461089157600080fd5b8063a3ec191a146107f0578063a5bbe22b14610607578063aa9641ab1461082457600080fd5b8063926d7d7f11610174578063926d7d7f146107945780639c9545f0146107c8578063a217fddf146107db57600080fd5b806391ad5039146106d057806391d148541461075057600080fd5b806341fcb6121161025357806363787e52116101fc578063886d36ff116101d6578063886d36ff146106655780638f0d6f17146106855780639010d07c1461069857600080fd5b806363787e521461058c578063820688d5146106075780638379a24f1461061d57600080fd5b80635960ccf21161022d5780635960ccf21461050b5780635aa6ccba1461053f5780635eb7d9461461056c57600080fd5b806341fcb612146104c257806345851694146104e257806358f85880146104f557600080fd5b806318e4357d116102b5578063295710ff1161028f578063295710ff146104555780632f2ff15d1461048257806336568abe146104a257600080fd5b806318e4357d146103ee578063190da5951461040e578063248a9ca31461042557600080fd5b8063051287bc116102e6578063051287bc1461037957806306f333f2146103b65780630f5f6ed7146103d857600080fd5b806301ffc9a71461030257806303ed0ee514610337575b600080fd5b34801561030e57600080fd5b5061032261031d366004612eef565b610aa9565b60405190151581526020015b60405180910390f35b34801561034357600080fd5b5061036b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d81565b60405190815260200161032e565b34801561038557600080fd5b506103a9610394366004612f31565b60009081526005602052604090205460ff1690565b60405161032e9190612fb4565b3480156103c257600080fd5b506103d66103d1366004612fe2565b610b05565b005b3480156103e457600080fd5b5061036b61271081565b3480156103fa57600080fd5b506103d661040936600461301b565b610bcc565b34801561041a57600080fd5b5061036b62093a8081565b34801561043157600080fd5b5061036b610440366004612f31565b60009081526020819052604090206001015490565b34801561046157600080fd5b5061036b610470366004613054565b60076020526000908152604090205481565b34801561048e57600080fd5b506103d661049d366004613071565b610d39565b3480156104ae57600080fd5b506103d66104bd366004613071565b610d64565b3480156104ce57600080fd5b506103d66104dd366004613209565b610db0565b6103d66104f0366004613329565b611026565b34801561050157600080fd5b5061036b60025481565b34801561051757600080fd5b5061036b7fdb9556138406326f00296e13ea2ad7db24ba82381212d816b1a40c23b466b32781565b34801561054b57600080fd5b5061055f61055a366004613346565b611083565b60405161032e91906133d3565b34801561057857600080fd5b506103d6610587366004613346565b611149565b34801561059857600080fd5b506105f76105a7366004612f31565b60056020526000908152604090205460ff811690610100810464ffffffffff16906601000000000000810465ffffffffffff16906c0100000000000000000000000090046001600160a01b031684565b60405161032e94939291906134e8565b34801561061357600080fd5b5061036b61070881565b34801561062957600080fd5b50610322610638366004612f31565b6000908152600660205260409020546c0100000000000000000000000090046001600160a01b0316151590565b34801561067157600080fd5b506103d6610680366004613529565b61133e565b6103d6610693366004613346565b611354565b3480156106a457600080fd5b506106b86106b336600461356e565b61135e565b6040516001600160a01b03909116815260200161032e565b3480156106dc57600080fd5b506107246106eb366004612f31565b600090815260056020526040902054610100810464ffffffffff16916c010000000000000000000000009091046001600160a01b031690565b604080516bffffffffffffffffffffffff90931683526001600160a01b0390911660208301520161032e565b34801561075c57600080fd5b5061032261076b366004613071565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3480156107a057600080fd5b5061036b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b6103d66107d6366004613209565b61137d565b3480156107e757600080fd5b5061036b600081565b3480156107fc57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561083057600080fd5b5061032261083f366004613071565b611603565b34801561085057600080fd5b5061086461085f366004613346565b6116ee565b60405161032e9190613590565b34801561087d57600080fd5b506103d661088c366004612f31565b6118a6565b34801561089d57600080fd5b5061036b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156108d157600080fd5b506103d66108e0366004612f31565b6119c8565b3480156108f157600080fd5b506103d6610900366004612f31565b611aaa565b34801561091157600080fd5b5061036b620f424081565b6103d661092a366004613676565b611b12565b34801561093b57600080fd5b506103d661094a366004613346565b611d94565b34801561095b57600080fd5b506109ae61096a366004612f31565b60066020526000908152604090205465ffffffffffff8082169166010000000000008104909116906c0100000000000000000000000090046001600160a01b031683565b6040805165ffffffffffff94851681529390921660208401526001600160a01b03169082015260600161032e565b3480156109e857600080fd5b5061036b6109f7366004612f31565b611d9f565b348015610a0857600080fd5b5061036b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5581565b348015610a3c57600080fd5b506103d6610a4b366004613071565b611db6565b348015610a5c57600080fd5b5061036b610a6b366004613054565b60036020526000908152604090205481565b348015610a8957600080fd5b5061036b61ffff81565b348015610a9f57600080fd5b5061036b60045481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f5a05180f000000000000000000000000000000000000000000000000000000001480610aff5750610aff82611ddb565b92915050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55610b2f81611e72565b6001600160a01b03831660009081526003602052604081205490819003610b565750505050565b6001600160a01b038416600081815260036020526040812055610b7a908483611e7c565b604080516001600160a01b038087168252851660208201529081018290527f244e51bc38c1452fa8aaf487bcb4bca36c2baa3a5fbdb776b1eabd8dc6d277cd9060600160405180910390a1505b505050565b7fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc4610bf681611e72565b600160008581526005602052604090205460ff166004811115610c1b57610c1b612f4a565b14610c52576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260056020908152604091829020805460027fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009091166101004264ffffffffff16027fffffffffffffffffffffffffffffffffffffffff000000000000ffffffffffff161766010000000000004365ffffffffffff160217176bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0387169081029190911790915582518681529251909287927f4ac8af8a2cd87193d64dfc7a3b8d9923b714ec528b18725d080aa1299be0c5e492918290030190a350505050565b600082815260208190526040902060010154610d5481611e72565b610d5e8383611f9f565b50505050565b6001600160a01b0381163314610da6576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610bc78282611fd4565b815160208301206000610dc284611083565b9050600260008381526005602052604090205460ff166004811115610de957610de9612f4a565b14610e20576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038316610e5d576000828152600560205260409020546c0100000000000000000000000090046001600160a01b03169250610ebd565b6000828152600560205260409020546c0100000000000000000000000090046001600160a01b03163314610ebd576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff90811642031611610f18576040517f1992d0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260056020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905561010081015115610f925761010081015160808201516001600160a01b031660009081526003602052604081208054909190610f8c908490613773565b90915550505b608081015160c0820151610fb06001600160a01b0383168683611e7c565b6000848152600560209081526040918290205482516001600160a01b038681168252928101859052888316936c010000000000000000000000009092049092169187917f582211c35a2139ac3bbaac74663c6a1f56c6cbb658b41fe11fd45a82074ac678910160405180910390a4505050505050565b611080816040518060a0016040528060006001600160a01b03168152602001600081526020016040518060200160405280600081525081526020016000815260200160405180602001604052806000815250815250611b12565b50565b611135604051806101e00160405280600063ffffffff168152602001600063ffffffff16815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001606081525090565b81806020019051810190610aff91906137e1565b80516020820120600061115b83611083565b9050600160008381526005602052604090205460ff16600481111561118257611182612f4a565b146111b9576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081527fd2043bf65931af3dbecf60d0db8f40e4160406d7beb00522f4200cf4944a1eb8602052604090205460ff161561123357806101400151421161122e576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61127f565b62093a808161014001516112479190613773565b421161127f576040517fe15ff9ea00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166004179055820151608083015161010084015160c0850151929391926112d89190613773565b90506112ee6001600160a01b0383168483611e7c565b604080516001600160a01b0384811682526020820184905285169187917fb4c55c0c9bc613519b920e88748090150b890a875d307f21bea7d4fb2e8bc958910160405180910390a3505050505050565b61135082805190602001208233610bcc565b5050565b611080813361137d565b60008281526001602052604081206113769083612001565b9392505050565b81516020830120600061138f84611083565b905061139c81838561200d565b604080516060808201835265ffffffffffff438116835242811660208085019182526001600160a01b0389811686880181815260008b815260068552899020975188549551915184166c01000000000000000000000000026bffffffffffffffffffffffff9288166601000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090971691909716179490941793909316939093179094558583015160a08088015160e08901516101208a01518a516080808d015160c0808f01518e5163ffffffff9095168552918b169c84019c909c52858a169c83019c909c529881019a909a52968901819052918801869052919691959094938716929189917ff8ae392d784b1ea5e8881bfa586d81abf07ef4f1e2fc75f7fe51c90f05199a5c910160405180910390a47fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b0384160161157957801561153b576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b813414611574576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115c7565b8034146115b2576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115c76001600160a01b0384163386856121aa565b6101c085015151156115e9576115e4848484886101c00151612226565b6115f9565b34156115f9576115f98434612385565b5050505050505050565b6000600260008481526005602052604090205460ff16600481111561162a5761162a612f4a565b14611661576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600560205260409020546001600160a01b038381166c0100000000000000000000000090920416146116c4576040517f4af43a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060009081526005602052604090205461070861010090910464ffffffffff9081164203161190565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820181905261016082015290517f5aa6ccba0000000000000000000000000000000000000000000000000000000081523090635aa6ccba90611787908590600401613916565b600060405180830381865afa9250505080156117c557506040513d6000823e601f3d908101601f191682016040526117c291908101906137e1565b60015b6117dd5781806020019051810190610aff9190613934565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff16815260200182604001516001600160a01b0316815260200182606001516001600160a01b0316815260200182608001516001600160a01b031681526020018260a001516001600160a01b031681526020018260c0015181526020018260e001518152602001826101000151815260200182610120015160001415151581526020018261014001518152602001826101600151815250915050919050565b919050565b7f043c983c49d46f0e102151eaf8085d4a2e6571d5df2d47b013f39bddfd4a639d6118d081611e72565b600260008381526005602052604090205460ff1660048111156118f5576118f5612f4a565b1461192c576040517f4145817200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604090205461070890610100900464ffffffffff9081164203161115611988576040517f3e908aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600560205260408082206001905551339184917f0695cf1d39b3055dcd0fe02d8b47eaf0d5a13e1996de925de59d0ef9b7f7fad49190a35050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f556119f281611e72565b612710821115611a63576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6e657746656552617465203e206d61780000000000000000000000000000000060448201526064015b60405180910390fd5b600280549083905560408051828152602081018590527f14914da2bf76024616fbe1859783fcd4dbddcb179b1f3a854949fbf920dcb95791015b60405180910390a1505050565b7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55611ad481611e72565b600480549083905560408051828152602081018590527f5cf09b12f3f56b4c564d51b25b40360af6d795198adb61ae0806a36c294323fa9101611a9d565b6000816020015142611b249190613a00565b9050611b3183838361244e565b6000611b4584606001518560a001516126d3565b90506000806002541115611b7257620f424060025483611b659190613a28565b611b6f9190613a3f565b90505b611b7c8183613a7a565b91506000604051806101e001604052804663ffffffff168152602001876000015163ffffffff16815260200187602001516001600160a01b0316815260200187604001516001600160a01b0316815260200187606001516001600160a01b0316815260200187608001516001600160a01b031681526020018481526020018760c0015181526020018381526020018660600151815260200187610100015181526020016007600089602001516001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190611c5990613a8d565b91905055815260200186600001516001600160a01b031681526020018581526020018660800151815250604051602001611c9391906133d3565b60408051808303601f1901815282825280516020808301919091206000818152600583529390932080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905589015189516060808c015160808d015160c08e0151928d015195985095966001600160a01b039094169587957f120ea0364f36cdac7983bcfdd55270ca09d7f9b314a2ebc425a3b01ab1d6403a95611d47958b95909493928e9290151590613ac5565b60405180910390a3807f3120e2bb59c86aca6890191a589a96af3662838efa374fbdcdf4c95bfe4a6c0e8760400151604051611d839190613916565b60405180910390a250505050505050565b611080816000610db0565b6000818152600160205260408120610aff906128b4565b600082815260208190526040902060010154611dd181611e72565b610d5e8383611fd4565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610aff57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610aff565b61108081336128be565b306001600160a01b03831603611e9157505050565b80600003611e9e57505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601611f8b576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f1b576040519150601f19603f3d011682016040523d82523d6000602084013e611f20565b606091505b5050905080610d5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401611a5a565b610bc76001600160a01b038416838361292a565b600080611fac848461295b565b90508015611376576000848152600160205260409020611fcc9084612a23565b509392505050565b600080611fe18484612a38565b90508015611376576000848152600160205260409020611fcc9084612ad9565b60006113768383612aee565b6001600160a01b03811661204d576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152600660205260409020546c0100000000000000000000000090046001600160a01b0316156120ac576040517fbef7bb7d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836020015163ffffffff16146120ef576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82610140015142111561212e576040517f559895a300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6101808301516001600160a01b0316158015906121625750806001600160a01b03168361018001516001600160a01b031614155b80156121735750826101a001514211155b15610bc7576040517f14be123200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610d5e9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612b18565b600083838360405160240161223d93929190613b1b565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f461e0c2100000000000000000000000000000000000000000000000000000000179052905060006122a4868334612b94565b905080516000036122e1576040517f1a95ad2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805160201461231c576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f461e0c210000000000000000000000000000000000000000000000000000000061234682613b4c565b1461237d576040517ff3725cca00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b804710156123c1576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a5a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461240e576040519150601f19603f3d011682016040523d82523d6000602084013e612413565b606091505b5050905080610bc7576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b46836000015163ffffffff1603612491576040517f7029fdf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a083015115806124a4575060c0830151155b156124db576040517fe38820c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208301516001600160a01b03161580612500575060408301516001600160a01b0316155b15612537576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608301516001600160a01b0316158061255c575060808301516001600160a01b0316155b15612593576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61259f61070842613773565b83610100015110156125dd576040517f04b7fcc800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff826080015151111561261e576040517ffbe24d4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082015115801590612651575060808301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b15612688576040517f2598ad2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008113158061269c575082610100015181135b15610bc7576040517f352807b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016127455734821461273e576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5034610aff565b612757836001600160a01b0316612c4a565b341561278f576040517f81de0bf300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa1580156127ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128109190613b91565b90506128276001600160a01b0384163330856121aa565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015281906001600160a01b038516906370a0823190602401602060405180830381865afa158015612886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128aa9190613b91565b6113769190613a7a565b6000610aff825490565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16611350576040517fe2517d3f0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260248101839052604401611a5a565b6040516001600160a01b03838116602483015260448201839052610bc791859182169063a9059cbb906064016121df565b6000828152602081815260408083206001600160a01b038516845290915281205460ff16612a1b576000838152602081815260408083206001600160a01b0386168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556129d33390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610aff565b506000610aff565b6000611376836001600160a01b038416612cf0565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1615612a1b576000838152602081815260408083206001600160a01b038616808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610aff565b6000611376836001600160a01b038416612d37565b6000826000018281548110612b0557612b05613baa565b9060005260206000200154905092915050565b6000612b2d6001600160a01b03841683612e2a565b90508051600014158015612b52575080806020019051810190612b509190613bd9565b155b15610bc7576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401611a5a565b606081471015612bd2576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401611a5a565b600080856001600160a01b03168486604051612bee9190613bf6565b60006040518083038185875af1925050503d8060008114612c2b576040519150601f19603f3d011682016040523d82523d6000602084013e612c30565b606091505b5091509150612c40868383612e38565b9695505050505050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03821601612cac576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806001600160a01b03163b600003611080576040517f7f523fe800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600183016020526040812054612a1b57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610aff565b60008181526001830160205260408120548015612e20576000612d5b600183613a7a565b8554909150600090612d6f90600190613a7a565b9050808214612dd4576000866000018281548110612d8f57612d8f613baa565b9060005260206000200154905080876000018481548110612db257612db2613baa565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612de557612de5613c12565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610aff565b6000915050610aff565b606061137683836000612b94565b606082612e4d57612e4882612ead565b611376565b8151158015612e6457506001600160a01b0384163b155b15612ea6576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401611a5a565b5080611376565b805115612ebd5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060208284031215612f0157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461137657600080fd5b600060208284031215612f4357600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60058110612fb0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610aff8284612f79565b6001600160a01b038116811461108057600080fd5b80356118a181612fc2565b60008060408385031215612ff557600080fd5b823561300081612fc2565b9150602083013561301081612fc2565b809150509250929050565b60008060006060848603121561303057600080fd5b8335925060208401359150604084013561304981612fc2565b809150509250925092565b60006020828403121561306657600080fd5b813561137681612fc2565b6000806040838503121561308457600080fd5b82359150602083013561301081612fc2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610120810167ffffffffffffffff811182821017156130e9576130e9613096565b60405290565b60405160a0810167ffffffffffffffff811182821017156130e9576130e9613096565b6040516101e0810167ffffffffffffffff811182821017156130e9576130e9613096565b604051610180810167ffffffffffffffff811182821017156130e9576130e9613096565b604051601f8201601f1916810167ffffffffffffffff8111828210171561318357613183613096565b604052919050565b600067ffffffffffffffff8211156131a5576131a5613096565b50601f01601f191660200190565b600082601f8301126131c457600080fd5b81356131d76131d28261318b565b61315a565b8181528460208386010111156131ec57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561321c57600080fd5b823567ffffffffffffffff81111561323357600080fd5b61323f858286016131b3565b925050602083013561301081612fc2565b63ffffffff8116811461108057600080fd5b80356118a181613250565b801515811461108057600080fd5b80356118a18161326d565b6000610120828403121561329957600080fd5b6132a16130c5565b90506132ac82613262565b81526132ba60208301612fd7565b60208201526132cb60408301612fd7565b60408201526132dc60608301612fd7565b60608201526132ed60808301612fd7565b608082015260a082013560a082015260c082013560c082015261331260e0830161327b565b60e082015261010080830135818301525092915050565b6000610120828403121561333c57600080fd5b6113768383613286565b60006020828403121561335857600080fd5b813567ffffffffffffffff81111561336f57600080fd5b61337b848285016131b3565b949350505050565b60005b8381101561339e578181015183820152602001613386565b50506000910152565b600081518084526133bf816020860160208601613383565b601f01601f19169290920160200192915050565b602081526133ea60208201835163ffffffff169052565b60006020830151613403604084018263ffffffff169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a06134c1818501836001600160a01b03169052565b8401516101c0848101919091528401516101e080850152905061337b6102008401826133a7565b608081016134f68287612f79565b64ffffffffff8516602083015265ffffffffffff841660408301526001600160a01b038316606083015295945050505050565b6000806040838503121561353c57600080fd5b823567ffffffffffffffff81111561355357600080fd5b61355f858286016131b3565b95602094909401359450505050565b6000806040838503121561358157600080fd5b50508035926020909101359150565b815163ffffffff168152610180810160208301516135b6602084018263ffffffff169052565b5060408301516135d160408401826001600160a01b03169052565b5060608301516135ec60608401826001600160a01b03169052565b50608083015161360760808401826001600160a01b03169052565b5060a083015161362260a08401826001600160a01b03169052565b5060c083015160c083015260e083015160e0830152610100808401518184015250610120808401516136578285018215159052565b5050610140838101519083015261016092830151929091019190915290565b600080610140838503121561368a57600080fd5b6136948484613286565b915061012083013567ffffffffffffffff808211156136b257600080fd5b9084019060a082870312156136c657600080fd5b6136ce6130ef565b82356136d981612fc2565b8152602083810135908201526040830135828111156136f757600080fd5b613703888286016131b3565b6040830152506060830135606082015260808301358281111561372557600080fd5b613731888286016131b3565b6080830152508093505050509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610aff57610aff613744565b80516118a181613250565b80516118a181612fc2565b600082601f8301126137ad57600080fd5b81516137bb6131d28261318b565b8181528460208386010111156137d057600080fd5b61337b826020830160208701613383565b6000602082840312156137f357600080fd5b815167ffffffffffffffff8082111561380b57600080fd5b908301906101e0828603121561382057600080fd5b613828613112565b61383183613786565b815261383f60208401613786565b602082015261385060408401613791565b604082015261386160608401613791565b606082015261387260808401613791565b608082015261388360a08401613791565b60a082015260c0838101519082015260e0808401519082015261010080840151908201526101208084015190820152610140808401519082015261016080840151908201526101806138d6818501613791565b908201526101a083810151908201526101c080840151838111156138f957600080fd5b6139058882870161379c565b918301919091525095945050505050565b60208152600061137660208301846133a7565b80516118a18161326d565b6000610180828403121561394757600080fd5b61394f613136565b61395883613786565b815261396660208401613786565b602082015261397760408401613791565b604082015261398860608401613791565b606082015261399960808401613791565b60808201526139aa60a08401613791565b60a082015260c083015160c082015260e083015160e08201526101008084015181830152506101206139dd818501613929565b908201526101408381015190820152610160928301519281019290925250919050565b8082018281126000831280158216821582161715613a2057613a20613744565b505092915050565b8082028115828204841417610aff57610aff613744565b600082613a75577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610aff57610aff613744565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613abe57613abe613744565b5060010190565b60e081526000613ad860e083018a6133a7565b63ffffffff989098166020830152506001600160a01b039586166040820152939094166060840152608083019190915260a082015290151560c090910152919050565b6001600160a01b0384168152826020820152606060408201526000613b4360608301846133a7565b95945050505050565b80516020808301519190811015613b8b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b600060208284031215613ba357600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613beb57600080fd5b81516113768161326d565b60008251613c08818460208701613383565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea2646970667358221220fef42b85b97e95ca087836390d97d99307ec60b38cd20d26ea0f113c18a0660d64736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"64760:20167:0:-:0;;;65906:1;65873:34;;66011:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;66045:6;63675:38;52847:4;66045:6;63675:10;:38::i;:::-;-1:-1:-1;;66077:12:0::1;66063:26;::::0;-1:-1:-1;64760:20167:0;;62160:257;62246:4;;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62318:69;62403:7;-1:-1:-1;62160:257:0;;;;;:::o;56794:316::-;56871:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;-1:-1:-1;;;;;56930:29:0;;;;;;;;;:36;;-1:-1:-1;;56930:36:0;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;-1:-1:-1;;;;;56985:40:0;57003:7;-1:-1:-1;;;;;56985:40:0;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;-1:-1:-1;;;;;32931:23:0;;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;14:290:1;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:1;;214:42;;204:70;;270:1;267;260:12;14:290;64760:20167:0;;;;;;;;;;;;;;;;;;","srcMapRuntime":"64760:20167:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;60820:212;;;;;;;;;;-1:-1:-1;60820:212:0;;;;;:::i;:::-;;:::i;:::-;;;612:14:1;;605:22;587:41;;575:2;560:18;60820:212:0;;;;;;;;63050:60;;;;;;;;;;;;63087:23;63050:60;;;;;785:25:1;;;773:2;758:18;63050:60:0;639:177:1;78427:150:0;;;;;;;;;;-1:-1:-1;78427:150:0;;;;;:::i;:::-;78495:19;78533:30;;;:15;:30;;;;;:37;;;;78427:150;;;;;;;;:::i;64022:359::-;;;;;;;;;;-1:-1:-1;64022:359:0;;;;;:::i;:::-;;:::i;:::-;;63232:45;;;;;;;;;;;;63271:6;63232:45;;76321:648;;;;;;;;;;-1:-1:-1;76321:648:0;;;;;:::i;:::-;;:::i;65110:45::-;;;;;;;;;;;;65149:6;65110:45;;54425:120;;;;;;;;;;-1:-1:-1;54425:120:0;;;;;:::i;:::-;54490:7;54516:12;;;;;;;;;;:22;;;;54425:120;65722:47;;;;;;;;;;-1:-1:-1;65722:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;54841:136;;;;;;;;;;-1:-1:-1;54841:136:0;;;;;:::i;:::-;;:::i;55943:245::-;;;;;;;;;;-1:-1:-1;55943:245:0;;;;;:::i;:::-;;:::i;77007:1414::-;;;;;;;;;;-1:-1:-1;77007:1414:0;;;;;:::i;:::-;;:::i;66134:369::-;;;;;;:::i;:::-;;:::i;63394:30::-;;;;;;;;;;;;;;;;62978:66;;;;;;;;;;;;63018:26;62978:66;;79105:169;;;;;;;;;;-1:-1:-1;79105:169:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67821:1169::-;;;;;;;;;;-1:-1:-1;67821:1169:0;;;;;:::i;:::-;;:::i;65482:58::-;;;;;;;;;;-1:-1:-1;65482:58:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;65482:58:0;;;;;;;;;;;;;:::i;65242:56::-;;;;;;;;;;;;65288:10;65242:56;;78866:199;;;;;;;;;;-1:-1:-1;78866:199:0;;;;;:::i;:::-;78932:4;79003:33;;;:18;:33;;;;;:41;;;;-1:-1:-1;;;;;79003:41:0;:55;;;78866:199;66696:170;;;;;;;;;;-1:-1:-1;66696:170:0;;;;;:::i;:::-;;:::i;66541:117::-;;;;;;:::i;:::-;;:::i;61617:142::-;;;;;;;;;;-1:-1:-1;61617:142:0;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;12205:55:1;;;12187:74;;12175:2;12160:18;61617:142:0;12041:226:1;78583:243:0;;;;;;;;;;-1:-1:-1;78583:243:0;;;;;:::i;:::-;78649:16;78706:30;;;:15;:30;;;;;:50;;;;;;;78776:43;;;;-1:-1:-1;;;;;78776:43:0;;78583:243;;;;;12474:26:1;12462:39;;;12444:58;;-1:-1:-1;;;;;12538:55:1;;;12533:2;12518:18;;12511:83;12417:18;78583:243:0;12272:328:1;53469:136:0;;;;;;;;;;-1:-1:-1;53469:136:0;;;;;:::i;:::-;53546:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;;;;53469:136;62908:64;;;;;;;;;;;;62947:25;62908:64;;73365:2916;;;;;;:::i;:::-;;:::i;52802:49::-;;;;;;;;;;-1:-1:-1;52802:49:0;52847:4;52802:49;;65968:36;;;;;;;;;;;;;;;69028:392;;;;;;;;;;-1:-1:-1;69028:392:0;;;;;:::i;:::-;;:::i;69755:1121::-;;;;;;;;;;-1:-1:-1;69755:1121:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;67048:735::-;;;;;;;;;;-1:-1:-1;67048:735:0;;;;;:::i;:::-;;:::i;65873:34::-;;;;;;;;;;;;;;;63726:290;;;;;;;;;;-1:-1:-1;63726:290:0;;;;;:::i;:::-;;:::i;64387:264::-;;;;;;;;;;-1:-1:-1;64387:264:0;;;;;:::i;:::-;;:::i;63189:37::-;;;;;;;;;;;;63223:3;63189:37;;70916:2409;;;;;;:::i;:::-;;:::i;66906:104::-;;;;;;;;;;-1:-1:-1;66906:104:0;;;;;:::i;:::-;;:::i;65597:57::-;;;;;;;;;;-1:-1:-1;65597:57:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;65597:57:0;;;;;;;15543:14:1;15584:15;;;15566:34;;15636:15;;;;15631:2;15616:18;;15609:43;-1:-1:-1;;;;;15688:55:1;15668:18;;;15661:83;15521:2;15506:18;65597:57:0;15335:415:1;61927:131:0;;;;;;;;;;-1:-1:-1;61927:131:0;;;;;:::i;:::-;;:::i;63116:66::-;;;;;;;;;;;;63156:26;63116:66;;55257:138;;;;;;;;;;-1:-1:-1;55257:138:0;;;;;:::i;:::-;;:::i;63480:47::-;;;;;;;;;;-1:-1:-1;63480:47:0;;;;;:::i;:::-;;;;;;;;;;;;;;65359:60;;;;;;;;;;;;65408:11;65359:60;;63601:29;;;;;;;;;;;;;;;;60820:212;60905:4;60928:57;;;60943:42;60928:57;;:97;;;60989:36;61013:11;60989:23;:36::i;:::-;60921:104;60820:212;-1:-1:-1;;60820:212:0:o;64022:359::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;-1:-1:-1;;;;;64146:19:0;::::1;64126:17;64146:19:::0;;;:12:::1;:19;::::0;;;;;;64179:14;;;64175:27:::1;;64195:7;64022:359:::0;;;:::o;64175:27::-:1;-1:-1:-1::0;;;;;64243:19:0;::::1;64265:1;64243:19:::0;;;:12:::1;:19;::::0;;;;:23;64276:45:::1;::::0;64300:9;64311;64276:23:::1;:45::i;:::-;64336:38;::::0;;-1:-1:-1;;;;;16036:15:1;;;16018:34;;16088:15;;16083:2;16068:18;;16061:43;16120:18;;;16113:34;;;64336:38:0::1;::::0;15945:2:1;15930:18;64336:38:0::1;;;;;;;64116:265;53105:1;64022:359:::0;;;:::o;76321:648::-;62947:25;53079:16;53090:4;53079:10;:16::i;:::-;76537:22:::1;76496:30;::::0;;;:15:::1;:30;::::0;;;;:37;::::1;;:63;::::0;::::1;;;;;;:::i;:::-;;76492:93;;76568:17;;;;;;;;;;;;;;76492:93;76595:30;::::0;;;:15:::1;:30;::::0;;;;;;;;:67;;76635:27:::1;76758:70:::0;;;;76672:76:::1;76732:15;76672:76;;;76758:70:::0;;;;76815:12:::1;76758:70;;;::::0;;76838:53;::::1;::::0;-1:-1:-1;;;;;76838:53:0;::::1;::::0;;::::1;::::0;;;::::1;::::0;;;76907:55;;785:25:1;;;76907:55:0;;76838:53;;76595:30;;76907:55:::1;::::0;;;;;;;::::1;76321:648:::0;;;;:::o;54841:136::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;54945:25:::1;54956:4;54962:7;54945:10;:25::i;:::-;;54841:136:::0;;;:::o;55943:245::-;-1:-1:-1;;;;;56036:34:0;;23368:10;56036:34;56032:102;;56093:30;;;;;;;;;;;;;;56032:102;56144:37;56156:4;56162:18;56144:11;:37::i;77007:1414::-;77097:18;;;;;;77073:21;77166:31;77107:7;77166:22;:31::i;:::-;77125:72;-1:-1:-1;77323:27:0;77282:30;;;;:15;:30;;;;;:37;;;:68;;;;;;;;:::i;:::-;;77278:98;;77359:17;;;;;;;;;;;;;;77278:98;-1:-1:-1;;;;;77470:16:0;;77466:213;;77507:30;;;;:15;:30;;;;;:43;;;;-1:-1:-1;;;;;77507:43:0;;-1:-1:-1;77466:213:0;;;77571:30;;;;:15;:30;;;;;:43;;;;-1:-1:-1;;;;;77571:43:0;77618:10;77571:57;77567:112;;77651:17;;;;;;;;;;;;;;77567:112;77704:30;;;;:15;:30;;;;;:50;65004:10;;77704:50;;;;;;;82347:15;82340:45;82332:53;77693:80;77689:142;;77796:24;;;;;;;;;;;;;;77689:142;77841:30;;;;:15;:30;;;;;:68;;;;77881:28;77841:68;;;77984:27;;;;:31;77980:105;;78058:27;;;;78030:23;;;;-1:-1:-1;;;;;78017:37:0;;;;;:12;:37;;;;;:68;;:37;;;:68;;78058:27;;78017:68;:::i;:::-;;;;-1:-1:-1;;77980:105:0;78180:23;;;;78230:24;;;;78264:35;-1:-1:-1;;;;;78264:23:0;;78288:2;78230:24;78264:23;:35::i;:::-;78351:30;;;;:15;:30;;;;;;;;;:43;78315:99;;-1:-1:-1;;;;;16669:55:1;;;16651:74;;16741:18;;;16734:34;;;78315:99:0;;;;78351:43;;;;;;;;:30;;78315:99;;16624:18:1;78315:99:0;;;;;;;77063:1358;;;;77007:1414;;:::o;66134:369::-;66205:291;66234:6;66264:221;;;;;;;;66319:1;-1:-1:-1;;;;;66264:221:0;;;;;66364:1;66264:221;;;;66392:9;;;;;;;;;;;;66264:221;;;;66430:1;66264:221;;;;66461:9;;;;;;;;;;;;66264:221;;;66205:6;:291::i;:::-;66134:369;:::o;79105:169::-;79180:26;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;79180:26:0;79236:7;79225:42;;;;;;;;;;;;:::i;67821:1169::-;67902:18;;;;;;67878:21;67972:31;67912:7;67972:22;:31::i;:::-;67931:72;-1:-1:-1;68059:22:0;68018:30;;;;:15;:30;;;;;:37;;;:63;;;;;;;;:::i;:::-;;68014:93;;68090:17;;;;;;;;;;;;;;68014:93;68145:10;53546:4;53569:29;;;:12;;:29;:12;:29;;;;;68118:382;;;68253:11;:20;;;68234:15;:39;68230:73;;68282:21;;;;;;;;;;;;;;68230:73;68118:382;;;65149:6;68424:11;:20;;;:35;;;;:::i;:::-;68405:15;:54;68401:88;;68468:21;;;;;;;;;;;;;;68401:88;68566:30;;;;:15;:30;;;;;;:61;;;;68606:21;68566:61;;;68713:24;;;68763:23;;;;68840:27;;;;68813:24;;;;68713;;68763:23;;68813:54;;68840:27;68813:54;:::i;:::-;68796:71;-1:-1:-1;68877:35:0;-1:-1:-1;;;;;68877:23:0;;68901:2;68796:71;68877:23;:35::i;:::-;68928:55;;;-1:-1:-1;;;;;16669:55:1;;;16651:74;;16756:2;16741:18;;16734:34;;;68928:55:0;;;68950:13;;68928:55;;16624:18:1;68928:55:0;;;;;;;67868:1122;;;;;67821:1169;:::o;66696:170::-;66772:87;66804:7;66794:18;;;;;;66826:10;66847;66772:5;:87::i;:::-;66696:170;;:::o;66541:117::-;66605:46;66621:7;66639:10;66605:5;:46::i;61617:142::-;61698:7;61724:18;;;:12;:18;;;;;:28;;61746:5;61724:21;:28::i;:::-;61717:35;61617:142;-1:-1:-1;;;61617:142:0:o;73365:2916::-;73468:18;;;;;;73444:21;73537:31;73478:7;73537:22;:31::i;:::-;73496:72;;73578:57;73599:11;73612:13;73627:7;73578:20;:57::i;:::-;73739:107;;;;;;;;;;73772:12;73739:107;;;;73810:15;73739:107;;;;;;;;;-1:-1:-1;;;;;73739:107:0;;;;;;;;;-1:-1:-1;73691:33:0;;;:18;:33;;;;;:155;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;73969:25;;;;74020:21;;;;;74068:22;;;;74120:21;;;;74344:25;;74396:23;;;;;74477:24;;;;;74209:374;;19501:10:1;19489:23;;;19471:42;;19610:15;;;19590:18;;;19583:43;;;;19662:15;;;19642:18;;;19635:43;;;;19694:18;;;19687:34;;;;19737:19;;;19730:35;;;19781:19;;;19774:35;;;73969:25:0;;74020:21;;74068:22;;74120:21;74209:374;;;73739:107;73691:33;;74209:374;;19443:19:1;74209:374:0;;;;;;;74798:38;-1:-1:-1;;;;;74798:38:0;;;74794:695;;74913:14;;74909:61;;74936:34;;;;;;;;;;;;;;74909:61;75058:6;75045:9;:19;75041:51;;75073:19;;;;;;;;;;;;;;75041:51;74794:695;;;75212:9;75199;:22;75195:54;;75230:19;;;;;;;;;;;;;;75195:54;75424;-1:-1:-1;;;;;75424:30:0;;75455:10;75467:2;75471:6;75424:30;:54::i;:::-;75503:22;;;;:29;:34;75499:776;;75855:104;75889:2;75900:5;75915:6;75935:11;:22;;;75855:21;:104::i;:::-;75499:776;;;75980:9;:14;75976:299;;76223:41;76249:2;76254:9;76223:17;:41::i;:::-;73434:2847;;;;;;73365:2916;;:::o;69028:392::-;69109:4;69170:27;69129:30;;;;:15;:30;;;;;:37;;;:68;;;;;;;;:::i;:::-;;69125:98;;69206:17;;;;;;;;;;;;;;69125:98;69237:30;;;;:15;:30;;;;;:43;-1:-1:-1;;;;;69237:54:0;;;:43;;;;;:54;69233:84;;69300:17;;;;;;;;;;;;;;69233:84;-1:-1:-1;;69345:30:0;;;;:15;:30;;;;;:50;65004:10;69345:50;;;;;;;;82347:15;82340:45;82332:53;69334:79;;69028:392::o;69755:1121::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;69956:36:0;;;;;:4;;:27;;:36;;69984:7;;69956:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;69956:36:0;;;;;;;;;;;;:::i;:::-;;;69952:918;;70830:7;70819:40;;;;;;;;;;;;:::i;69952:918::-;70146:597;;;;;;;;70197:4;:18;;;70146:597;;;;;;70246:4;:16;;;70146:597;;;;;;70294:4;:17;;;-1:-1:-1;;;;;70146:597:0;;;;;70344:4;:18;;;-1:-1:-1;;;;;70146:597:0;;;;;70393:4;:16;;;-1:-1:-1;;;;;70146:597:0;;;;;70438:4;:14;;;-1:-1:-1;;;;;70146:597:0;;;;;70484:4;:17;;;70146:597;;;;70531:4;:15;;;70146:597;;;;70581:4;:20;;;70146:597;;;;70633:4;:14;;;70651:1;70633:19;;70146:597;;;;;;70680:4;:13;;;70146:597;;;;70718:4;:10;;;70146:597;;;70139:604;;;69755:1121;;;:::o;69952:918::-;69755:1121;;;:::o;67048:735::-;63087:23;53079:16;53090:4;53079:10;:16::i;:::-;67173:27:::1;67132:30;::::0;;;:15:::1;:30;::::0;;;;:37;::::1;;:68;::::0;::::1;;;;;;:::i;:::-;;67128:98;;67209:17;;;;;;;;;;;;;;67128:98;67251:30;::::0;;;:15:::1;:30;::::0;;;;:50;65004:10:::1;::::0;67251:50:::1;::::0;::::1;;::::0;;::::1;82347:15:::0;82340:45;82332:53;67240:79:::1;67236:138;;;67342:21;;;;;;;;;;;;;;67236:138;67461:30;::::0;;;:15:::1;:30;::::0;;;;;67501:22:::1;67663:51:::0;;67730:46;67765:10:::1;::::0;67461:30;;67730:46:::1;::::0;67461:30;67730:46:::1;67048:735:::0;;:::o;63726:290::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;63271:6:::1;63825:10;:26;;63817:55;;;::::0;::::1;::::0;;21574:2:1;63817:55:0::1;::::0;::::1;21556:21:1::0;21613:2;21593:18;;;21586:30;21652:18;21632;;;21625:46;21688:18;;63817:55:0::1;;;;;;;;;63903:15;::::0;;63928:28;;;;63971:38:::1;::::0;;21891:25:1;;;21947:2;21932:18;;21925:34;;;63971:38:0::1;::::0;21864:18:1;63971:38:0::1;;;;;;;;63807:209;63726:290:::0;;:::o;64387:264::-;63156:26;53079:16;53090:4;53079:10;:16::i;:::-;64512:14:::1;::::0;;64536:34;;;;64585:59:::1;::::0;;21891:25:1;;;21947:2;21932:18;;21925:34;;;64585:59:0::1;::::0;21864:18:1;64585:59:0::1;21717:248:1::0;70916:2409:0;71017:25;71071:8;:32;;;71052:15;71045:58;;;;:::i;:::-;71017:86;;71113:59;71135:6;71143:8;71153:18;71113:21;:59::i;:::-;71308:20;71331:62;71353:6;:18;;;71373:6;:19;;;71331:21;:62::i;:::-;71308:85;;71461:23;71516:1;71498:15;;:19;71494:85;;;63223:3;71553:15;;71538:12;:30;;;;:::i;:::-;71537:42;;;;:::i;:::-;71519:60;;71494:85;71589:31;71605:15;71589:31;;:::i;:::-;;;71733:20;71780:924;;;;;;;;71840:13;71780:924;;;;;;71885:6;:17;;;71780:924;;;;;;71934:6;:13;;;-1:-1:-1;;;;;71780:924:0;;;;;71980:6;:9;;;-1:-1:-1;;;;;71780:924:0;;;;;72020:6;:18;;;-1:-1:-1;;;;;71780:924:0;;;;;72067:6;:16;;;-1:-1:-1;;;;;71780:924:0;;;;;72115:12;71780:924;;;;72157:6;:17;;;71780:924;;;;72209:15;71780:924;;;;72253:8;:18;;;71780:924;;;;72299:6;:15;;;71780:924;;;;72339:12;:27;72352:6;:13;;;-1:-1:-1;;;;;72339:27:0;-1:-1:-1;;;;;72339:27:0;;;;;;;;;;;;;:29;;;;;;;;;:::i;:::-;;;;;71780:924;;;;72441:8;:21;;;-1:-1:-1;;;;;71780:924:0;;;;;72621:18;71780:924;;;;72670:8;:19;;;71780:924;;;71756:958;;;;;;;;:::i;:::-;;;;;;;-1:-1:-1;;71756:958:0;;;;;;72748:18;;71756:958;72748:18;;;;;;;72724:21;72776:30;;;:15;:30;;;;;;:62;;;;72816:22;72776:62;;;72934:13;;;73004:17;;73048:18;;;;;73091:16;;;;73173:17;;;;73218:18;;;;71756:958;;-1:-1:-1;72748:18:0;;-1:-1:-1;;;;;72854:398:0;;;;72748:18;;72854:398;;;;71756:958;;73004:17;;73048:18;73091:16;73135:12;;73218:23;;;;72854:398;:::i;:::-;;;;;;;;73286:13;73267:51;73301:8;:16;;;73267:51;;;;;;:::i;:::-;;;;;;;;71007:2318;;;;;70916:2409;;:::o;66906:104::-;66962:41;66978:7;66999:1;66962:5;:41::i;61927:131::-;61998:7;62024:18;;;:12;:18;;;;;:27;;:25;:27::i;55257:138::-;54490:7;54516:12;;;;;;;;;;:22;;;53079:16;53090:4;53079:10;:16::i;:::-;55362:26:::1;55374:4;55380:7;55362:11;:26::i;53180:202::-:0;53265:4;53288:47;;;53303:32;53288:47;;:87;;-1:-1:-1;45095:25:0;45080:40;;;;53339:36;44981:146;53814:103;53880:30;53891:4;23368:10;53880;:30::i;58092:653::-;58267:4;-1:-1:-1;;;;;58253:19:0;;;58249:32;;58092:653;;;:::o;58249:32::-;58353:5;58362:1;58353:10;58349:23;;58092:653;;;:::o;58349:23::-;58385:20;-1:-1:-1;;;;;58385:20:0;;;58381:358;;58565:12;58582:2;-1:-1:-1;;;;;58582:7:0;58597:5;58582:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;58564:43;;;58629:7;58621:39;;;;;;;24145:2:1;58621:39:0;;;24127:21:1;24184:2;24164:18;;;24157:30;24223:21;24203:18;;;24196:49;24262:18;;58621:39:0;23943:343:1;58381:358:0;58691:37;-1:-1:-1;;;;;58691:26:0;;58718:2;58722:5;58691:26;:37::i;62160:257::-;62246:4;62262:12;62277:31;62294:4;62300:7;62277:16;:31::i;:::-;62262:46;;62322:7;62318:69;;;62345:18;;;;:12;:18;;;;;:31;;62368:7;62345:22;:31::i;:::-;;62403:7;62160:257;-1:-1:-1;;;62160:257:0:o;62520:262::-;62607:4;62623:12;62638:32;62656:4;62662:7;62638:17;:32::i;:::-;62623:47;;62684:7;62680:72;;;62707:18;;;;:12;:18;;;;;:34;;62733:7;62707:25;:34::i;34071:156::-;34145:7;34195:22;34199:3;34211:5;34195:3;:22::i;83982:943::-;-1:-1:-1;;;;;84170:21:0;;84166:47;;84200:13;;;;;;;;;;;;;;84166:47;78932:4;79003:33;;;:18;:33;;;;;:41;;;;-1:-1:-1;;;;;79003:41:0;:55;84284:60;;84324:20;;;;;;;;;;;;;;84284:60;84385:13;84358:11;:23;;;:40;;;84354:69;;84407:16;;;;;;;;;;;;;;84354:69;84505:11;:20;;;84487:15;:38;84483:69;;;84534:18;;;;;;;;;;;;;;84483:69;84682:30;;;;-1:-1:-1;;;;;84682:44:0;;;;;:101;;;84776:7;-1:-1:-1;;;;;84742:41:0;:11;:30;;;-1:-1:-1;;;;;84742:41:0;;;84682:101;:166;;;;;84818:11;:30;;;84799:15;:49;;84682:166;84665:254;;;84880:28;;;;;;;;;;;;;;46696:188;46823:53;;-1:-1:-1;;;;;16036:15:1;;;46823:53:0;;;16018:34:1;16088:15;;;16068:18;;;16061:43;16120:18;;;16113:34;;;46796:81:0;;46816:5;;46838:18;;;;;15930::1;;46823:53:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;46796:19;:81::i;80749:999::-;80924:21;81025:5;81032:6;81040:10;80960:92;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;80960:92:0;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;81159:84:0;81198:9;80960:92;81232:9;81159:29;:84::i;:::-;81133:110;;81309:10;:17;81330:1;81309:22;81305:59;;81340:24;;;;;;;;;;;;;;81305:59;81443:10;:17;81464:2;81443:23;81439:67;;81475:31;;;;;;;;;;;;;;81439:67;81620:56;81589:19;81597:10;81589:19;:::i;:::-;:88;81585:157;;81700:31;;;;;;;;;;;;;;81585:157;80914:834;;80749:999;;;;:::o;17900:331::-;18009:6;17985:21;:30;17981:109;;;18038:41;;;;;18073:4;18038:41;;;12187:74:1;12160:18;;18038:41:0;12041:226:1;17981:109:0;18101:12;18119:9;-1:-1:-1;;;;;18119:14:0;18141:6;18119:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18100:52;;;18167:7;18162:63;;18197:17;;;;;;;;;;;;;;82727:1176;82980:13;82959:6;:17;;;:34;;;82955:63;;83002:16;;;;;;;;;;;;;;82955:63;83032:19;;;;:24;;:50;;-1:-1:-1;83060:17:0;;;;:22;83032:50;83028:80;;;83091:17;;;;;;;;;;;;;;83028:80;83122:13;;;;-1:-1:-1;;;;;83122:27:0;;;:54;;-1:-1:-1;83153:9:0;;;;-1:-1:-1;;;;;83153:23:0;;83122:54;83118:80;;;83185:13;;;;;;;;;;;;;;83118:80;83212:18;;;;-1:-1:-1;;;;;83212:32:0;;;:66;;-1:-1:-1;83248:16:0;;;;-1:-1:-1;;;;;83248:30:0;;83212:66;83208:92;;;83287:13;;;;;;;;;;;;;;83208:92;83332:37;65288:10;83332:15;:37;:::i;:::-;83314:6;:15;;;:55;83310:86;;;83378:18;;;;;;;;;;;;;;83310:86;65408:11;83437:8;:19;;;:26;:51;83433:90;;;83497:26;;;;;;;;;;;;;;83433:90;83537:18;;;;:23;;;;:76;;-1:-1:-1;83564:16:0;;;;-1:-1:-1;;;;;83564:49:0;57809:42;83564:49;83537:76;83533:148;;;83636:34;;;;;;;;;;;;;;83533:148;83786:1;83764:18;:23;;:71;;;;83819:6;:15;;;83791:18;:44;83764:71;83760:137;;;83858:28;;;;;;;;;;;;;;79527:1064;79607:19;79642:38;-1:-1:-1;;;;;79642:38:0;;;79638:947;;79867:9;79857:6;:19;79853:51;;79885:19;;;;;;;;;;;;;;79853:51;-1:-1:-1;79932:9:0;79638:947;;;80168:24;:5;-1:-1:-1;;;;;80168:22:0;;:24::i;:::-;80210:9;:14;80206:46;;80233:19;;;;;;;;;;;;;;80206:46;80280:38;;;;;80312:4;80280:38;;;12187:74:1;-1:-1:-1;;;;;80280:23:0;;;;;12160:18:1;;80280:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;80266:52;-1:-1:-1;80332:65:0;-1:-1:-1;;;;;80332:30:0;;80363:10;80383:4;80390:6;80332:30;:65::i;:::-;80522:38;;;;;80554:4;80522:38;;;12187:74:1;80563:11:0;;-1:-1:-1;;;;;80522:23:0;;;;;12160:18:1;;80522:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:52;;;;:::i;33614:115::-;33677:7;33703:19;33711:3;29053:18;;28971:107;54047:197;53546:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;54130:108;;54180:47;;;;;-1:-1:-1;;;;;16669:55:1;;54180:47:0;;;16651:74:1;16741:18;;;16734:34;;;16624:18;;54180:47:0;16477:297:1;46297:160:0;46406:43;;-1:-1:-1;;;;;16669:55:1;;;46406:43:0;;;16651:74:1;16741:18;;;16734:34;;;46379:71:0;;46399:5;;46421:14;;;;;16624:18:1;;46406:43:0;16477:297:1;56794:316:0;56871:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;56887:217;;56930:6;:12;;;;;;;;;;;-1:-1:-1;;;;;56930:29:0;;;;;;;;;:36;;;;56962:4;56930:36;;;57012:12;23368:10;;23289:96;57012:12;-1:-1:-1;;;;;56985:40:0;57003:7;-1:-1:-1;;;;;56985:40:0;56997:4;56985:40;;;;;;;;;;-1:-1:-1;57046:4:0;57039:11;;56887:217;-1:-1:-1;57088:5:0;57081:12;;32813:150;32883:4;32906:50;32911:3;-1:-1:-1;;;;;32931:23:0;;32906:4;:50::i;57345:317::-;57423:4;53569:12;;;;;;;;;;;-1:-1:-1;;;;;53569:29:0;;;;;;;;;;;;57439:217;;;57513:5;57481:12;;;;;;;;;;;-1:-1:-1;;;;;57481:29:0;;;;;;;;;;:37;;;;;;57537:40;23368:10;;57481:12;;57537:40;;57513:5;57537:40;-1:-1:-1;57598:4:0;57591:11;;33131:156;33204:4;33227:53;33235:3;-1:-1:-1;;;;;33255:23:0;;33227:7;:53::i;29420:118::-;29487:7;29513:3;:11;;29525:5;29513:18;;;;;;;;:::i;:::-;;;;;;;;;29506:25;;29420:118;;;;:::o;49053:629::-;49472:23;49498:33;-1:-1:-1;;;;;49498:27:0;;49526:4;49498:27;:33::i;:::-;49472:59;;49545:10;:17;49566:1;49545:22;;:57;;;;;49583:10;49572:30;;;;;;;;;;;;:::i;:::-;49571:31;49545:57;49541:135;;;49625:40;;;;;-1:-1:-1;;;;;12205:55:1;;49625:40:0;;;12187:74:1;12160:18;;49625:40:0;12041:226:1;19549:392:0;19648:12;19700:5;19676:21;:29;19672:108;;;19728:41;;;;;19763:4;19728:41;;;12187:74:1;12160:18;;19728:41:0;12041:226:1;19672:108:0;19790:12;19804:23;19831:6;-1:-1:-1;;;;;19831:11:0;19850:5;19857:4;19831:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19789:73;;;;19879:55;19906:6;19914:7;19923:10;19879:26;:55::i;:::-;19872:62;19549:392;-1:-1:-1;;;;;;19549:392:0:o;59909:344::-;60076:38;-1:-1:-1;;;;;60076:38:0;;;60072:69;;60123:18;;;;;;;;;;;;;;60072:69;60197:5;-1:-1:-1;;;;;60197:17:0;;60218:1;60197:22;60193:53;;60228:18;;;;;;;;;;;;;;26738:406;26801:4;28857:21;;;:14;;;:21;;;;;;26817:321;;-1:-1:-1;26859:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;27041:18;;27017:21;;;:14;;;:21;;;;;;:42;;;;27073:11;;27312:1368;27378:4;27507:21;;;:14;;;:21;;;;;;27543:13;;27539:1135;;27910:18;27931:12;27942:1;27931:8;:12;:::i;:::-;27977:18;;27910:33;;-1:-1:-1;27957:17:0;;27977:22;;27998:1;;27977:22;:::i;:::-;27957:42;;28032:9;28018:10;:23;28014:378;;28061:17;28081:3;:11;;28093:9;28081:22;;;;;;;;:::i;:::-;;;;;;;;;28061:42;;28228:9;28202:3;:11;;28214:10;28202:23;;;;;;;;:::i;:::-;;;;;;;;;;;;:35;;;;28341:25;;;:14;;;:25;;;;;:36;;;28014:378;28470:17;;:3;;:17;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;28573:3;:14;;:21;28588:5;28573:21;;;;;;;;;;;28566:28;;;28616:4;28609:11;;;;;;;27539:1135;28658:5;28651:12;;;;;19074:151;19149:12;19180:38;19202:6;19210:4;19216:1;19180:21;:38::i;20994:582::-;21138:12;21167:7;21162:408;;21190:19;21198:10;21190:7;:19::i;:::-;21162:408;;;21414:17;;:22;:49;;;;-1:-1:-1;;;;;;21440:18:0;;;:23;21414:49;21410:119;;;21490:24;;;;;-1:-1:-1;;;;;12205:55:1;;21490:24:0;;;12187:74:1;12160:18;;21490:24:0;12041:226:1;21410:119:0;-1:-1:-1;21549:10:0;21542:17;;22112:516;22243:17;;:21;22239:383;;22471:10;22465:17;22527:15;22514:10;22510:2;22506:19;22499:44;22239:383;22594:17;;;;;;;;;;;;;;14:332:1;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;180:9;167:23;230:66;223:5;219:78;212:5;209:89;199:117;;312:1;309;302:12;821:180;880:6;933:2;921:9;912:7;908:23;904:32;901:52;;;949:1;946;939:12;901:52;-1:-1:-1;972:23:1;;821:180;-1:-1:-1;821:180:1:o;1006:184::-;1058:77;1055:1;1048:88;1155:4;1152:1;1145:15;1179:4;1176:1;1169:15;1195:297;1279:1;1272:5;1269:12;1259:200;;1315:77;1312:1;1305:88;1416:4;1413:1;1406:15;1444:4;1441:1;1434:15;1259:200;1468:18;;1195:297::o;1497:214::-;1646:2;1631:18;;1658:47;1635:9;1687:6;1658:47;:::i;1716:154::-;-1:-1:-1;;;;;1795:5:1;1791:54;1784:5;1781:65;1771:93;;1860:1;1857;1850:12;1875:134;1943:20;;1972:31;1943:20;1972:31;:::i;2014:388::-;2082:6;2090;2143:2;2131:9;2122:7;2118:23;2114:32;2111:52;;;2159:1;2156;2149:12;2111:52;2198:9;2185:23;2217:31;2242:5;2217:31;:::i;:::-;2267:5;-1:-1:-1;2324:2:1;2309:18;;2296:32;2337:33;2296:32;2337:33;:::i;:::-;2389:7;2379:17;;;2014:388;;;;;:::o;2589:383::-;2666:6;2674;2682;2735:2;2723:9;2714:7;2710:23;2706:32;2703:52;;;2751:1;2748;2741:12;2703:52;2787:9;2774:23;2764:33;;2844:2;2833:9;2829:18;2816:32;2806:42;;2898:2;2887:9;2883:18;2870:32;2911:31;2936:5;2911:31;:::i;:::-;2961:5;2951:15;;;2589:383;;;;;:::o;2977:247::-;3036:6;3089:2;3077:9;3068:7;3064:23;3060:32;3057:52;;;3105:1;3102;3095:12;3057:52;3144:9;3131:23;3163:31;3188:5;3163:31;:::i;3229:315::-;3297:6;3305;3358:2;3346:9;3337:7;3333:23;3329:32;3326:52;;;3374:1;3371;3364:12;3326:52;3410:9;3397:23;3387:33;;3470:2;3459:9;3455:18;3442:32;3483:31;3508:5;3483:31;:::i;3549:184::-;3601:77;3598:1;3591:88;3698:4;3695:1;3688:15;3722:4;3719:1;3712:15;3738:255;3810:2;3804:9;3852:6;3840:19;;3889:18;3874:34;;3910:22;;;3871:62;3868:88;;;3936:18;;:::i;:::-;3972:2;3965:22;3738:255;:::o;3998:253::-;4070:2;4064:9;4112:4;4100:17;;4147:18;4132:34;;4168:22;;;4129:62;4126:88;;;4194:18;;:::i;4256:255::-;4328:2;4322:9;4370:6;4358:19;;4407:18;4392:34;;4428:22;;;4389:62;4386:88;;;4454:18;;:::i;4516:252::-;4588:2;4582:9;4630:3;4618:16;;4664:18;4649:34;;4685:22;;;4646:62;4643:88;;;4711:18;;:::i;4773:334::-;4844:2;4838:9;4900:2;4890:13;;-1:-1:-1;;4886:86:1;4874:99;;5003:18;4988:34;;5024:22;;;4985:62;4982:88;;;5050:18;;:::i;:::-;5086:2;5079:22;4773:334;;-1:-1:-1;4773:334:1:o;5112:245::-;5160:4;5193:18;5185:6;5182:30;5179:56;;;5215:18;;:::i;:::-;-1:-1:-1;5272:2:1;5260:15;-1:-1:-1;;5256:88:1;5346:4;5252:99;;5112:245::o;5362:462::-;5404:5;5457:3;5450:4;5442:6;5438:17;5434:27;5424:55;;5475:1;5472;5465:12;5424:55;5511:6;5498:20;5542:48;5558:31;5586:2;5558:31;:::i;:::-;5542:48;:::i;:::-;5615:2;5606:7;5599:19;5661:3;5654:4;5649:2;5641:6;5637:15;5633:26;5630:35;5627:55;;;5678:1;5675;5668:12;5627:55;5743:2;5736:4;5728:6;5724:17;5717:4;5708:7;5704:18;5691:55;5791:1;5766:16;;;5784:4;5762:27;5755:38;;;;5770:7;5362:462;-1:-1:-1;;;5362:462:1:o;5829:455::-;5906:6;5914;5967:2;5955:9;5946:7;5942:23;5938:32;5935:52;;;5983:1;5980;5973:12;5935:52;6023:9;6010:23;6056:18;6048:6;6045:30;6042:50;;;6088:1;6085;6078:12;6042:50;6111:49;6152:7;6143:6;6132:9;6128:22;6111:49;:::i;:::-;6101:59;;;6210:2;6199:9;6195:18;6182:32;6223:31;6248:5;6223:31;:::i;6289:121::-;6374:10;6367:5;6363:22;6356:5;6353:33;6343:61;;6400:1;6397;6390:12;6415:132;6482:20;;6511:30;6482:20;6511:30;:::i;6552:118::-;6638:5;6631:13;6624:21;6617:5;6614:32;6604:60;;6660:1;6657;6650:12;6675:128;6740:20;;6769:28;6740:20;6769:28;:::i;6808:806::-;6867:5;6915:6;6903:9;6898:3;6894:19;6890:32;6887:52;;;6935:1;6932;6925:12;6887:52;6957:22;;:::i;:::-;6948:31;;7002:28;7020:9;7002:28;:::i;:::-;6995:5;6988:43;7063:38;7097:2;7086:9;7082:18;7063:38;:::i;:::-;7058:2;7051:5;7047:14;7040:62;7134:38;7168:2;7157:9;7153:18;7134:38;:::i;:::-;7129:2;7122:5;7118:14;7111:62;7205:38;7239:2;7228:9;7224:18;7205:38;:::i;:::-;7200:2;7193:5;7189:14;7182:62;7277:39;7311:3;7300:9;7296:19;7277:39;:::i;:::-;7271:3;7264:5;7260:15;7253:64;7378:3;7367:9;7363:19;7350:33;7344:3;7337:5;7333:15;7326:58;7445:3;7434:9;7430:19;7417:33;7411:3;7404:5;7400:15;7393:58;7484:36;7515:3;7504:9;7500:19;7484:36;:::i;:::-;7478:3;7471:5;7467:15;7460:61;7540:3;7603:2;7592:9;7588:18;7575:32;7570:2;7563:5;7559:14;7552:56;;6808:806;;;;:::o;7619:237::-;7707:6;7760:3;7748:9;7739:7;7735:23;7731:33;7728:53;;;7777:1;7774;7767:12;7728:53;7800:50;7842:7;7831:9;7800:50;:::i;7861:320::-;7929:6;7982:2;7970:9;7961:7;7957:23;7953:32;7950:52;;;7998:1;7995;7988:12;7950:52;8038:9;8025:23;8071:18;8063:6;8060:30;8057:50;;;8103:1;8100;8093:12;8057:50;8126:49;8167:7;8158:6;8147:9;8143:22;8126:49;:::i;:::-;8116:59;7861:320;-1:-1:-1;;;;7861:320:1:o;8417:250::-;8502:1;8512:113;8526:6;8523:1;8520:13;8512:113;;;8602:11;;;8596:18;8583:11;;;8576:39;8548:2;8541:10;8512:113;;;-1:-1:-1;;8659:1:1;8641:16;;8634:27;8417:250::o;8672:329::-;8713:3;8751:5;8745:12;8778:6;8773:3;8766:19;8794:76;8863:6;8856:4;8851:3;8847:14;8840:4;8833:5;8829:16;8794:76;:::i;:::-;8915:2;8903:15;-1:-1:-1;;8899:88:1;8890:98;;;;8990:4;8886:109;;8672:329;-1:-1:-1;;8672:329:1:o;9006:1866::-;9209:2;9198:9;9191:21;9221:52;9269:2;9258:9;9254:18;9245:6;9239:13;8262:10;8251:22;8239:35;;8186:94;9221:52;9172:4;9320:2;9312:6;9308:15;9302:22;9333:51;9380:2;9369:9;9365:18;9351:12;8262:10;8251:22;8239:35;;8186:94;9333:51;-1:-1:-1;9433:2:1;9421:15;;9415:22;-1:-1:-1;;;;;8351:54:1;;9496:2;9481:18;;8339:67;-1:-1:-1;9549:2:1;9537:15;;9531:22;-1:-1:-1;;;;;8351:54:1;;9612:3;9597:19;;8339:67;-1:-1:-1;9666:3:1;9654:16;;9648:23;-1:-1:-1;;;;;8351:54:1;;9730:3;9715:19;;8339:67;-1:-1:-1;9784:3:1;9772:16;;9766:23;-1:-1:-1;;;;;8351:54:1;;9848:3;9833:19;;8339:67;-1:-1:-1;9908:3:1;9896:16;;9890:23;9884:3;9869:19;;;9862:52;;;;9939:16;;9933:23;9975:3;9994:18;;;9987:30;;;;10042:15;;10036:22;10077:3;10096:18;;;10089:30;;;;10144:15;;10138:22;10179:3;10198:18;;;10191:30;;;;10246:15;;10240:22;10281:3;10300:18;;;10293:30;;;;10348:15;;10342:22;10384:3;10403:19;;;10396:31;;;;10464:16;;10458:23;10501:3;10513:55;10548:19;;;10458:23;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;10513:55;10594:16;;10588:23;10631:3;10650:19;;;10643:32;;;;10712:16;;10706:23;10749:6;10771:19;;;10764:32;10706:23;-1:-1:-1;10813:53:1;10861:3;10846:19;;10706:23;10813:53;:::i;10877:513::-;11106:3;11091:19;;11119:47;11095:9;11148:6;11119:47;:::i;:::-;11214:12;11206:6;11202:25;11197:2;11186:9;11182:18;11175:53;11276:14;11268:6;11264:27;11259:2;11248:9;11244:18;11237:55;-1:-1:-1;;;;;11332:6:1;11328:55;11323:2;11312:9;11308:18;11301:83;10877:513;;;;;;;:::o;11395:388::-;11472:6;11480;11533:2;11521:9;11512:7;11508:23;11504:32;11501:52;;;11549:1;11546;11539:12;11501:52;11589:9;11576:23;11622:18;11614:6;11611:30;11608:50;;;11654:1;11651;11644:12;11608:50;11677:49;11718:7;11709:6;11698:9;11694:22;11677:49;:::i;:::-;11667:59;11773:2;11758:18;;;;11745:32;;-1:-1:-1;;;;11395:388:1:o;11788:248::-;11856:6;11864;11917:2;11905:9;11896:7;11892:23;11888:32;11885:52;;;11933:1;11930;11923:12;11885:52;-1:-1:-1;;11956:23:1;;;12026:2;12011:18;;;11998:32;;-1:-1:-1;11788:248:1:o;12605:1373::-;12836:13;;8262:10;8251:22;8239:35;;12805:3;12790:19;;12908:4;12900:6;12896:17;12890:24;12923:53;12970:4;12959:9;12955:20;12941:12;8262:10;8251:22;8239:35;;8186:94;12923:53;;13025:4;13017:6;13013:17;13007:24;13040:56;13090:4;13079:9;13075:20;13059:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13040:56;;13145:4;13137:6;13133:17;13127:24;13160:56;13210:4;13199:9;13195:20;13179:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13160:56;;13265:4;13257:6;13253:17;13247:24;13280:56;13330:4;13319:9;13315:20;13299:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13280:56;;13385:4;13377:6;13373:17;13367:24;13400:56;13450:4;13439:9;13435:20;13419:14;-1:-1:-1;;;;;8351:54:1;8339:67;;8285:127;13400:56;;13512:4;13504:6;13500:17;13494:24;13487:4;13476:9;13472:20;13465:54;13575:4;13567:6;13563:17;13557:24;13550:4;13539:9;13535:20;13528:54;13601:6;13661:2;13653:6;13649:15;13643:22;13638:2;13627:9;13623:18;13616:50;;13685:6;13740:2;13732:6;13728:15;13722:22;13753:51;13800:2;13789:9;13785:18;13769:14;421:13;414:21;402:34;;351:91;13753:51;-1:-1:-1;;13823:6:1;13871:15;;;13865:22;13845:18;;;13838:50;13907:6;13955:15;;;13949:22;13929:18;;;;13922:50;;;;12605:1373;:::o;14168:1162::-;14297:6;14305;14358:3;14346:9;14337:7;14333:23;14329:33;14326:53;;;14375:1;14372;14365:12;14326:53;14398:50;14440:7;14429:9;14398:50;:::i;:::-;14388:60;;14499:3;14488:9;14484:19;14471:33;14523:18;14564:2;14556:6;14553:14;14550:34;;;14580:1;14577;14570:12;14550:34;14603:22;;;;14659:4;14641:16;;;14637:27;14634:47;;;14677:1;14674;14667:12;14634:47;14703:22;;:::i;:::-;14762:2;14749:16;14774:33;14799:7;14774:33;:::i;:::-;14816:22;;14891:2;14883:11;;;14870:25;14854:14;;;14847:49;14942:2;14934:11;;14921:25;14958:16;;;14955:36;;;14987:1;14984;14977:12;14955:36;15023:44;15059:7;15048:8;15044:2;15040:17;15023:44;:::i;:::-;15018:2;15011:5;15007:14;15000:68;;15121:2;15117;15113:11;15100:25;15095:2;15088:5;15084:14;15077:49;15172:3;15168:2;15164:12;15151:26;15202:2;15192:8;15189:16;15186:36;;;15218:1;15215;15208:12;15186:36;15255:44;15291:7;15280:8;15276:2;15272:17;15255:44;:::i;:::-;15249:3;15242:5;15238:15;15231:69;;15319:5;15309:15;;;;;14168:1162;;;;;:::o;16158:184::-;16210:77;16207:1;16200:88;16307:4;16304:1;16297:15;16331:4;16328:1;16321:15;16347:125;16412:9;;;16433:10;;;16430:36;;;16446:18;;:::i;16779:136::-;16857:13;;16879:30;16857:13;16879:30;:::i;16920:138::-;16999:13;;17021:31;16999:13;17021:31;:::i;17063:441::-;17116:5;17169:3;17162:4;17154:6;17150:17;17146:27;17136:55;;17187:1;17184;17177:12;17136:55;17216:6;17210:13;17247:48;17263:31;17291:2;17263:31;:::i;17247:48::-;17320:2;17311:7;17304:19;17366:3;17359:4;17354:2;17346:6;17342:15;17338:26;17335:35;17332:55;;;17383:1;17380;17373:12;17332:55;17396:77;17470:2;17463:4;17454:7;17450:18;17443:4;17435:6;17431:17;17396:77;:::i;17509:1672::-;17616:6;17669:2;17657:9;17648:7;17644:23;17640:32;17637:52;;;17685:1;17682;17675:12;17637:52;17718:9;17712:16;17747:18;17788:2;17780:6;17777:14;17774:34;;;17804:1;17801;17794:12;17774:34;17827:22;;;;17883:6;17865:16;;;17861:29;17858:49;;;17903:1;17900;17893:12;17858:49;17929:22;;:::i;:::-;17974:32;18003:2;17974:32;:::i;:::-;17967:5;17960:47;18039:41;18076:2;18072;18068:11;18039:41;:::i;:::-;18034:2;18027:5;18023:14;18016:65;18113:42;18151:2;18147;18143:11;18113:42;:::i;:::-;18108:2;18101:5;18097:14;18090:66;18188:42;18226:2;18222;18218:11;18188:42;:::i;:::-;18183:2;18176:5;18172:14;18165:66;18264:43;18302:3;18298:2;18294:12;18264:43;:::i;:::-;18258:3;18251:5;18247:15;18240:68;18341:43;18379:3;18375:2;18371:12;18341:43;:::i;:::-;18335:3;18324:15;;18317:68;18432:3;18424:12;;;18418:19;18401:15;;;18394:44;18485:3;18477:12;;;18471:19;18454:15;;;18447:44;18510:3;18551:11;;;18545:18;18529:14;;;18522:42;18583:3;18624:11;;;18618:18;18602:14;;;18595:42;18656:3;18697:11;;;18691:18;18675:14;;;18668:42;18729:3;18770:11;;;18764:18;18748:14;;;18741:42;18802:3;18837:42;18867:11;;;18837:42;:::i;:::-;18821:14;;;18814:66;18899:3;18940:11;;;18934:18;18918:14;;;18911:42;18972:3;19006:11;;;19000:18;19030:16;;;19027:36;;;19059:1;19056;19049:12;19027:36;19095:55;19142:7;19131:8;19127:2;19123:17;19095:55;:::i;:::-;19079:14;;;19072:79;;;;-1:-1:-1;19083:5:1;17509:1672;-1:-1:-1;;;;;17509:1672:1:o;19820:217::-;19967:2;19956:9;19949:21;19930:4;19987:44;20027:2;20016:9;20012:18;20004:6;19987:44;:::i;20042:132::-;20118:13;;20140:28;20118:13;20140:28;:::i;20179:1188::-;20282:6;20335:3;20323:9;20314:7;20310:23;20306:33;20303:53;;;20352:1;20349;20342:12;20303:53;20378:22;;:::i;:::-;20423:39;20452:9;20423:39;:::i;:::-;20416:5;20409:54;20495:48;20539:2;20528:9;20524:18;20495:48;:::i;:::-;20490:2;20483:5;20479:14;20472:72;20576:49;20621:2;20610:9;20606:18;20576:49;:::i;:::-;20571:2;20564:5;20560:14;20553:73;20658:49;20703:2;20692:9;20688:18;20658:49;:::i;:::-;20653:2;20646:5;20642:14;20635:73;20741:50;20786:3;20775:9;20771:19;20741:50;:::i;:::-;20735:3;20728:5;20724:15;20717:75;20825:50;20870:3;20859:9;20855:19;20825:50;:::i;:::-;20819:3;20812:5;20808:15;20801:75;20930:3;20919:9;20915:19;20909:26;20903:3;20896:5;20892:15;20885:51;20990:3;20979:9;20975:19;20969:26;20963:3;20956:5;20952:15;20945:51;21015:3;21071:2;21060:9;21056:18;21050:25;21045:2;21038:5;21034:14;21027:49;;21095:3;21130:46;21172:2;21161:9;21157:18;21130:46;:::i;:::-;21114:14;;;21107:70;21196:3;21237:18;;;21231:25;21215:14;;;21208:49;21276:3;21317:18;;;21311:25;21295:14;;;21288:49;;;;-1:-1:-1;21118:5:1;20179:1188;-1:-1:-1;20179:1188:1:o;21970:216::-;22034:9;;;22062:11;;;22009:3;22092:9;;22120:10;;22116:19;;22145:10;;22137:19;;22113:44;22110:70;;;22160:18;;:::i;:::-;22110:70;;21970:216;;;;:::o;22191:168::-;22264:9;;;22295;;22312:15;;;22306:22;;22292:37;22282:71;;22333:18;;:::i;22364:274::-;22404:1;22430;22420:189;;22465:77;22462:1;22455:88;22566:4;22563:1;22556:15;22594:4;22591:1;22584:15;22420:189;-1:-1:-1;22623:9:1;;22364:274::o;22643:128::-;22710:9;;;22731:11;;;22728:37;;;22745:18;;:::i;22776:195::-;22815:3;22846:66;22839:5;22836:77;22833:103;;22916:18;;:::i;:::-;-1:-1:-1;22963:1:1;22952:13;;22776:195::o;22976:752::-;23283:3;23272:9;23265:22;23246:4;23304:45;23344:3;23333:9;23329:19;23321:6;23304:45;:::i;:::-;23397:10;23385:23;;;;23380:2;23365:18;;23358:51;-1:-1:-1;;;;;;23506:15:1;;;23501:2;23486:18;;23479:43;23558:15;;;;23553:2;23538:18;;23531:43;23605:3;23590:19;;23583:35;;;;23649:3;23634:19;;23627:35;23706:14;;23699:22;23693:3;23678:19;;;23671:51;23296:53;22976:752;-1:-1:-1;22976:752:1:o;24291:408::-;-1:-1:-1;;;;;24498:6:1;24494:55;24483:9;24476:74;24586:6;24581:2;24570:9;24566:18;24559:34;24629:2;24624;24613:9;24609:18;24602:30;24457:4;24649:44;24689:2;24678:9;24674:18;24666:6;24649:44;:::i;:::-;24641:52;24291:408;-1:-1:-1;;;;;24291:408:1:o;24704:357::-;24822:12;;24869:4;24858:16;;;24852:23;;24822:12;24887:16;;24884:171;;;24977:66;24967:6;24961:4;24957:17;24954:1;24950:25;24946:98;24939:5;24935:110;24926:119;;24884:171;;24704:357;;;:::o;25066:184::-;25136:6;25189:2;25177:9;25168:7;25164:23;25160:32;25157:52;;;25205:1;25202;25195:12;25157:52;-1:-1:-1;25228:16:1;;25066:184;-1:-1:-1;25066:184:1:o;25557:::-;25609:77;25606:1;25599:88;25706:4;25703:1;25696:15;25730:4;25727:1;25720:15;25746:245;25813:6;25866:2;25854:9;25845:7;25841:23;25837:32;25834:52;;;25882:1;25879;25872:12;25834:52;25914:9;25908:16;25933:28;25955:5;25933:28;:::i;25996:287::-;26125:3;26163:6;26157:13;26179:66;26238:6;26233:3;26226:4;26218:6;26214:17;26179:66;:::i;:::-;26261:16;;;;;25996:287;-1:-1:-1;;25996:287:1:o;26288:184::-;26340:77;26337:1;26330:88;26437:4;26434:1;26427:15;26461:4;26458:1;26451:15","abiDefinition":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AmountIncorrect","type":"error"},{"inputs":[],"name":"CallParamsLengthAboveMax","type":"error"},{"inputs":[],"name":"ChainIncorrect","type":"error"},{"inputs":[],"name":"DeadlineExceeded","type":"error"},{"inputs":[],"name":"DeadlineNotExceeded","type":"error"},{"inputs":[],"name":"DeadlineTooShort","type":"error"},{"inputs":[],"name":"DisputePeriodNotPassed","type":"error"},{"inputs":[],"name":"DisputePeriodPassed","type":"error"},{"inputs":[],"name":"ExclusivityParamsIncorrect","type":"error"},{"inputs":[],"name":"ExclusivityPeriodNotPassed","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","type":"error"},{"inputs":[],"name":"NativeTokenCallValueNotSupported","type":"error"},{"inputs":[],"name":"RecipientIncorrectReturnValue","type":"error"},{"inputs":[],"name":"RecipientNoReturnValue","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SenderIncorrect","type":"error"},{"inputs":[],"name":"StatusIncorrect","type":"error"},{"inputs":[],"name":"TokenNotContract","type":"error"},{"inputs":[],"name":"TransactionRelayed","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"BridgeProofDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"bytes32","name":"transactionHash","type":"bytes32"}],"name":"BridgeProofProvided","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"quoteId","type":"bytes"}],"name":"BridgeQuoteDetails","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint32","name":"originChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainGasAmount","type":"uint256"}],"name":"BridgeRelayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes","name":"request","type":"bytes"},{"indexed":false,"internalType":"uint32","name":"destChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sendChainGas","type":"bool"}],"name":"BridgeRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldChainGasAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"ChainGasAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesSwept","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DISPUTE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RATE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GUARD_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CALL_PARAMS_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEADLINE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFUNDER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REFUND_DELAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"},{"components":[{"internalType":"address","name":"quoteRelayer","type":"address"},{"internalType":"int256","name":"quoteExclusivitySeconds","type":"int256"},{"internalType":"bytes","name":"quoteId","type":"bytes"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeParamsV2","name":"paramsV2","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeProofs","outputs":[{"internalType":"uint96","name":"timestamp","type":"uint96"},{"internalType":"address","name":"relayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeRelayDetails","outputs":[{"internalType":"uint48","name":"blockNumber","type":"uint48"},{"internalType":"uint48","name":"blockTimestamp","type":"uint48"},{"internalType":"address","name":"relayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum IFastBridgeV2.BridgeStatus","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeTxDetails","outputs":[{"internalType":"enum IFastBridgeV2.BridgeStatus","name":"status","type":"uint8"},{"internalType":"uint40","name":"proofBlockTimestamp","type":"uint40"},{"internalType":"uint48","name":"proofBlockNumber","type":"uint48"},{"internalType":"address","name":"proofRelayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainGasAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deployBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"dispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransaction","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IFastBridge.BridgeTransaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransactionV2","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"exclusivityRelayer","type":"address"},{"internalType":"uint256","name":"exclusivityEndTime","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeTransactionV2","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"protocolFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"relayer","type":"address"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"senderNonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"setChainGasAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"setProtocolFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{"DISPUTE_PERIOD()":{"notice":"Dispute period for relayed transactions"},"MAX_CALL_PARAMS_LENGTH()":{"notice":"Maximum length of accepted callParams"},"MIN_DEADLINE_PERIOD()":{"notice":"Minimum deadline period to relay a requested bridge transaction"},"REFUND_DELAY()":{"notice":"Delay for a transaction after which it could be permisionlessly refunded"},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer."},"bridgeProofs(bytes32)":{"notice":"Returns the timestamp and relayer of a bridge proof"},"bridgeRelayDetails(bytes32)":{"notice":"Relay details on destination chain"},"bridgeRelays(bytes32)":{"notice":"Checks if a transaction has been relayed"},"bridgeStatuses(bytes32)":{"notice":"Returns the status of a bridge transaction"},"bridgeTxDetails(bytes32)":{"notice":"Status of the bridge tx on origin chain"},"canClaim(bytes32,address)":{"notice":"Checks if the dispute period has passed so bridge deposit can be claimed"},"chainGasAmount()":{"notice":"Chain gas amount to forward as rebate if requested"},"claim(bytes)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof."},"claim(bytes,address)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital"},"deployBlock()":{"notice":"the block the contract was deployed at"},"dispute(bytes32)":{"notice":"Disputes an outstanding proof in case relayer provided dest chain tx is invalid"},"getBridgeTransaction(bytes)":{"notice":"Decodes bridge request into a bridge transaction"},"getBridgeTransactionV2(bytes)":{"notice":"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2"},"nonce()":{"notice":"This is deprecated and should not be used."},"protocolFeeRate()":{"notice":"Protocol fee rate taken on origin amount deposited in origin chain"},"protocolFees(address)":{"notice":"Protocol fee amounts accumulated"},"prove(bytes,bytes32)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"prove(bytes32,bytes32,address)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"refund(bytes)":{"notice":"Refunds an outstanding bridge transaction in case optimistic bridging failed"},"relay(bytes)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"},"relay(bytes,address)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"},"senderNonces(address)":{"notice":"Unique bridge nonces tracked per originSender"}},"notice":"FastBridgeV2 is a contract for bridging tokens across chains.","version":1},"developerDoc":{"errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}],"AddressEmptyCode(address)":[{"details":"There's no code at `target` (it is not a contract)."}],"AddressInsufficientBalance(address)":[{"details":"The ETH balance of the account is not enough to perform the operation."}],"FailedInnerCall()":[{"details":"A call to an address target failed. The target may have reverted."}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC20 token failed."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"params":{"params":"The parameters required to bridge"}},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"params":{"params":"The parameters required to bridge","paramsV2":"The parameters for exclusivity fill rights (optional, can be left empty)"}},"bridgeProofs(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"relayer":"The relayer address of the bridge proof","timestamp":"The timestamp of the bridge proof"}},"bridgeRelays(bytes32)":{"params":{"transactionId":"The ID of the transaction to check"},"returns":{"_0":"True if the transaction has been relayed, false otherwise"}},"bridgeStatuses(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"status":"BridgeStatus Status of the bridge transaction"}},"canClaim(bytes32,address)":{"params":{"relayer":"The address of the relayer attempting to claim","transactionId":"The transaction id associated with the encoded bridge transaction to check"}},"claim(bytes)":{"params":{"request":"The encoded bridge transaction to claim on origin chain"}},"claim(bytes,address)":{"params":{"request":"The encoded bridge transaction to claim on origin chain","to":"The recipient address of the funds"}},"dispute(bytes32)":{"params":{"transactionId":"The transaction id associated with the encoded bridge transaction to dispute"}},"getBridgeTransaction(bytes)":{"details":"This method is added to achieve backwards compatibility with decoding requests into V1 structs: - `callValue` is partially reported as a zero/non-zero flag - `callParams` is ignored In order to process all kinds of requests use getBridgeTransactionV2 instead.","params":{"request":"The bridge request to decode"}},"getBridgeTransactionV2(bytes)":{"params":{"request":"The bridge request to decode"}},"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"prove(bytes,bytes32)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","request":"The encoded bridge transaction to prove on origin chain"}},"prove(bytes32,bytes32,address)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","relayer":"The address of the relaying entity which should have control of the origin funds when claimed","transactionId":"The transaction id associated with the encoded bridge transaction to prove"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"request":"The encoded bridge transaction to relay on destination chain"}},"relay(bytes,address)":{"params":{"relayer":"The address of the relaying entity which should have control of the origin funds when claimed","request":"The encoded bridge transaction to relay on destination chain"}},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"supportsInterface(bytes4)":{"details":"See {IERC165-supportsInterface}."}},"stateVariables":{"nonce":{"details":"Replaced by senderNonces"}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AmountIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallParamsLengthAboveMax\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChainIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineNotExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityParamsIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NativeTokenCallValueNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientIncorrectReturnValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientNoReturnValue\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StatusIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransactionRelayed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"BridgeProofDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"transactionHash\",\"type\":\"bytes32\"}],\"name\":\"BridgeProofProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"}],\"name\":\"BridgeQuoteDetails\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"}],\"name\":\"BridgeRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldChainGasAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"ChainGasAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldFeeRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"FeeRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FeesSwept\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DISPUTE_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_BPS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FEE_RATE_MAX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOVERNOR_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GUARD_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAX_CALL_PARAMS_LENGTH\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MIN_DEADLINE_PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REFUNDER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"REFUND_DELAY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RELAYER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"quoteRelayer\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"quoteExclusivitySeconds\",\"type\":\"int256\"},{\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeParamsV2\",\"name\":\"paramsV2\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeProofs\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"timestamp\",\"type\":\"uint96\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeRelayDetails\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"blockNumber\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"blockTimestamp\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum IFastBridgeV2.BridgeStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"bridgeTxDetails\",\"outputs\":[{\"internalType\":\"enum IFastBridgeV2.BridgeStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"uint40\",\"name\":\"proofBlockTimestamp\",\"type\":\"uint40\"},{\"internalType\":\"uint48\",\"name\":\"proofBlockNumber\",\"type\":\"uint48\"},{\"internalType\":\"address\",\"name\":\"proofRelayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"canClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"chainGasAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deployBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransaction\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeTransaction\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransactionV2\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"exclusivityRelayer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exclusivityEndTime\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeTransactionV2\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFeeRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"protocolFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"senderNonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"setChainGasAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"sweepProtocolFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}],\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"AddressInsufficientBalance(address)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"FailedInnerCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"params\":{\"params\":\"The parameters required to bridge\"}},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"params\":{\"params\":\"The parameters required to bridge\",\"paramsV2\":\"The parameters for exclusivity fill rights (optional, can be left empty)\"}},\"bridgeProofs(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"relayer\":\"The relayer address of the bridge proof\",\"timestamp\":\"The timestamp of the bridge proof\"}},\"bridgeRelays(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the transaction to check\"},\"returns\":{\"_0\":\"True if the transaction has been relayed, false otherwise\"}},\"bridgeStatuses(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"status\":\"BridgeStatus Status of the bridge transaction\"}},\"canClaim(bytes32,address)\":{\"params\":{\"relayer\":\"The address of the relayer attempting to claim\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to check\"}},\"claim(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\"}},\"claim(bytes,address)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\",\"to\":\"The recipient address of the funds\"}},\"dispute(bytes32)\":{\"params\":{\"transactionId\":\"The transaction id associated with the encoded bridge transaction to dispute\"}},\"getBridgeTransaction(bytes)\":{\"details\":\"This method is added to achieve backwards compatibility with decoding requests into V1 structs: - `callValue` is partially reported as a zero/non-zero flag - `callParams` is ignored In order to process all kinds of requests use getBridgeTransactionV2 instead.\",\"params\":{\"request\":\"The bridge request to decode\"}},\"getBridgeTransactionV2(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"prove(bytes,bytes32)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"request\":\"The encoded bridge transaction to prove on origin chain\"}},\"prove(bytes32,bytes32,address)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to prove\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to relay on destination chain\"}},\"relay(bytes,address)\":{\"params\":{\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"request\":\"The encoded bridge transaction to relay on destination chain\"}},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"}},\"stateVariables\":{\"nonce\":{\"details\":\"Replaced by senderNonces\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"DISPUTE_PERIOD()\":{\"notice\":\"Dispute period for relayed transactions\"},\"MAX_CALL_PARAMS_LENGTH()\":{\"notice\":\"Maximum length of accepted callParams\"},\"MIN_DEADLINE_PERIOD()\":{\"notice\":\"Minimum deadline period to relay a requested bridge transaction\"},\"REFUND_DELAY()\":{\"notice\":\"Delay for a transaction after which it could be permisionlessly refunded\"},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer\"},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer.\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Returns the timestamp and relayer of a bridge proof\"},\"bridgeRelayDetails(bytes32)\":{\"notice\":\"Relay details on destination chain\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Checks if a transaction has been relayed\"},\"bridgeStatuses(bytes32)\":{\"notice\":\"Returns the status of a bridge transaction\"},\"bridgeTxDetails(bytes32)\":{\"notice\":\"Status of the bridge tx on origin chain\"},\"canClaim(bytes32,address)\":{\"notice\":\"Checks if the dispute period has passed so bridge deposit can be claimed\"},\"chainGasAmount()\":{\"notice\":\"Chain gas amount to forward as rebate if requested\"},\"claim(bytes)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof.\"},\"claim(bytes,address)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital\"},\"deployBlock()\":{\"notice\":\"the block the contract was deployed at\"},\"dispute(bytes32)\":{\"notice\":\"Disputes an outstanding proof in case relayer provided dest chain tx is invalid\"},\"getBridgeTransaction(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction\"},\"getBridgeTransactionV2(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\"},\"nonce()\":{\"notice\":\"This is deprecated and should not be used.\"},\"protocolFeeRate()\":{\"notice\":\"Protocol fee rate taken on origin amount deposited in origin chain\"},\"protocolFees(address)\":{\"notice\":\"Protocol fee amounts accumulated\"},\"prove(bytes,bytes32)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"prove(bytes32,bytes32,address)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"refund(bytes)\":{\"notice\":\"Refunds an outstanding bridge transaction in case optimistic bridging failed\"},\"relay(bytes)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"},\"relay(bytes,address)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"},\"senderNonces(address)\":{\"notice\":\"Unique bridge nonces tracked per originSender\"}},\"notice\":\"FastBridgeV2 is a contract for bridging tokens across chains.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"FastBridgeV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"DEFAULT_ADMIN_ROLE()":"a217fddf","DISPUTE_PERIOD()":"a5bbe22b","FEE_BPS()":"bf333f2c","FEE_RATE_MAX()":"0f5f6ed7","GOVERNOR_ROLE()":"ccc57490","GUARD_ROLE()":"03ed0ee5","MAX_CALL_PARAMS_LENGTH()":"df36bb13","MIN_DEADLINE_PERIOD()":"820688d5","REFUNDER_ROLE()":"5960ccf2","REFUND_DELAY()":"190da595","RELAYER_ROLE()":"926d7d7f","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":"bfc7c607","bridgeProofs(bytes32)":"91ad5039","bridgeRelayDetails(bytes32)":"c79371b1","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","bridgeTxDetails(bytes32)":"63787e52","canClaim(bytes32,address)":"aa9641ab","chainGasAmount()":"e00a83e0","claim(bytes)":"c63ff8dd","claim(bytes,address)":"41fcb612","deployBlock()":"a3ec191a","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","getBridgeTransactionV2(bytes)":"5aa6ccba","getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","nonce()":"affed0e0","protocolFeeRate()":"58f85880","protocolFees(address)":"dcf844a7","prove(bytes,bytes32)":"886d36ff","prove(bytes32,bytes32,address)":"18e4357d","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","relay(bytes,address)":"9c9545f0","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f","senderNonces(address)":"295710ff","setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","supportsInterface(bytes4)":"01ffc9a7","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeV2.sol:IAccessControl":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"External interface of AccessControl declared to support ERC165 detection.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"External interface of AccessControl declared to support ERC165 detection.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IAccessControl\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridgeV2.sol:IAccessControlEnumerable":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"External interface of AccessControlEnumerable declared to support ERC165 detection.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}]},"events":{"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)"}},"kind":"dev","methods":{"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}."},"getRoleMember(bytes32,uint256)":{"details":"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information."},"getRoleMemberCount(bytes32)":{"details":"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AccessControlBadConfirmation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"neededRole\",\"type\":\"bytes32\"}],\"name\":\"AccessControlUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"callerConfirmation\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"External interface of AccessControlEnumerable declared to support ERC165 detection.\",\"errors\":{\"AccessControlBadConfirmation()\":[{\"details\":\"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\"}],\"AccessControlUnauthorizedAccount(address,bytes32)\":[{\"details\":\"The `account` is missing a role.\"}]},\"events\":{\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this.\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call: - if using `revokeRole`, it is the admin role bearer - if using `renounceRole`, it is the role bearer (i.e. `account`)\"}},\"kind\":\"dev\",\"methods\":{\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {AccessControl-_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IAccessControlEnumerable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"getRoleAdmin(bytes32)":"248a9ca3","getRoleMember(bytes32,uint256)":"9010d07c","getRoleMemberCount(bytes32)":"ca15c873","grantRole(bytes32,address)":"2f2ff15d","hasRole(bytes32,address)":"91d14854","renounceRole(bytes32,address)":"36568abe","revokeRole(bytes32,address)":"d547741f"}},"solidity/FastBridgeV2.sol:IAdmin":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldChainGasAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"ChainGasAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"FeeRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesSwept","type":"event"},{"inputs":[{"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"setChainGasAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newFeeRate","type":"uint256"}],"name":"setProtocolFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldChainGasAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"ChainGasAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldFeeRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"FeeRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"FeesSwept\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newChainGasAmount\",\"type\":\"uint256\"}],\"name\":\"setChainGasAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"newFeeRate\",\"type\":\"uint256\"}],\"name\":\"setProtocolFeeRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"sweepProtocolFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IAdmin\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"setChainGasAmount(uint256)":"b250fe6b","setProtocolFeeRate(uint256)":"b13aa2d6","sweepProtocolFees(address,address)":"06f333f2"}},"solidity/FastBridgeV2.sol:IERC165":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.","kind":"dev","methods":{"supportsInterface(bytes4)":{"details":"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC165 standard, as defined in the https://eips.ethereum.org/EIPS/eip-165[EIP]. Implementers can declare support of contract interfaces, which can then be queried by others ({ERC165Checker}). For an implementation, see {ERC165}.\",\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IERC165\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"supportsInterface(bytes4)":"01ffc9a7"}},"solidity/FastBridgeV2.sol:IERC20":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Interface of the ERC20 standard as defined in the EIP.","events":{"Approval(address,address,uint256)":{"details":"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance."},"Transfer(address,address,uint256)":{"details":"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero."}},"kind":"dev","methods":{"allowance(address,address)":{"details":"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called."},"approve(address,uint256)":{"details":"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event."},"balanceOf(address)":{"details":"Returns the value of tokens owned by `account`."},"totalSupply()":{"details":"Returns the value of tokens in existence."},"transfer(address,uint256)":{"details":"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event."},"transferFrom(address,address,uint256)":{"details":"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC20 standard as defined in the EIP.\",\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when the allowance of a `spender` for an `owner` is set by a call to {approve}. `value` is the new allowance.\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero.\"}},\"kind\":\"dev\",\"methods\":{\"allowance(address,address)\":{\"details\":\"Returns the remaining number of tokens that `spender` will be allowed to spend on behalf of `owner` through {transferFrom}. This is zero by default. This value changes when {approve} or {transferFrom} are called.\"},\"approve(address,uint256)\":{\"details\":\"Sets a `value` amount of tokens as the allowance of `spender` over the caller's tokens. Returns a boolean value indicating whether the operation succeeded. IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 Emits an {Approval} event.\"},\"balanceOf(address)\":{\"details\":\"Returns the value of tokens owned by `account`.\"},\"totalSupply()\":{\"details\":\"Returns the value of tokens in existence.\"},\"transfer(address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism. `value` is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd"}},"solidity/FastBridgeV2.sol:IERC20Permit":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.","kind":"dev","methods":{"DOMAIN_SEPARATOR()":{"details":"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}."},"nonces(address)":{"details":"Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times."},"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":{"details":"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above."}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't need to send a transaction, and thus is not required to hold Ether at all. ==== Security Considerations There are two important considerations concerning the use of `permit`. The first is that a valid permit signature expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be considered as an intention to spend the allowance in any specific way. The second is that because permits have built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be generally recommended is: ```solidity function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} doThing(..., value); } function doThing(..., uint256 value) public { token.safeTransferFrom(msg.sender, address(this), value); ... } ``` Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also {SafeERC20-safeTransferFrom}). Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so contracts should have entry points that don't rely on permit.\",\"kind\":\"dev\",\"methods\":{\"DOMAIN_SEPARATOR()\":{\"details\":\"Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\"},\"nonces(address)\":{\"details\":\"Returns the current nonce for `owner`. This value must be included whenever a signature is generated for {permit}. Every successful call to {permit} increases ``owner``'s nonce by one. This prevents a signature from being used multiple times.\"},\"permit(address,address,uint256,uint256,uint8,bytes32,bytes32)\":{\"details\":\"Sets `value` as the allowance of `spender` over ``owner``'s tokens, given ``owner``'s signed approval. IMPORTANT: The same issues {IERC20-approve} has related to transaction ordering also apply here. Emits an {Approval} event. Requirements: - `spender` cannot be the zero address. - `deadline` must be a timestamp in the future. - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` over the EIP712-formatted function arguments. - the signature must use ``owner``'s current nonce (see {nonces}). For more information on the signature format, see the https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP section]. CAUTION: See Security Considerations above.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IERC20Permit\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"DOMAIN_SEPARATOR()":"3644e515","nonces(address)":"7ecebe00","permit(address,address,uint256,uint256,uint8,bytes32,bytes32)":"d505accf"}},"solidity/FastBridgeV2.sol:IFastBridge":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"BridgeProofDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"bytes32","name":"transactionHash","type":"bytes32"}],"name":"BridgeProofProvided","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint32","name":"originChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainGasAmount","type":"uint256"}],"name":"BridgeRelayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes","name":"request","type":"bytes"},{"indexed":false,"internalType":"uint32","name":"destChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sendChainGas","type":"bool"}],"name":"BridgeRequested","type":"event"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"dispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransaction","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IFastBridge.BridgeTransaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"}],"userDoc":{"kind":"user","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"canClaim(bytes32,address)":{"notice":"Checks if the dispute period has passed so bridge deposit can be claimed"},"claim(bytes,address)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital"},"dispute(bytes32)":{"notice":"Disputes an outstanding proof in case relayer provided dest chain tx is invalid"},"getBridgeTransaction(bytes)":{"notice":"Decodes bridge request into a bridge transaction"},"prove(bytes,bytes32)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"refund(bytes)":{"notice":"Refunds an outstanding bridge transaction in case optimistic bridging failed"},"relay(bytes)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"}},"version":1},"developerDoc":{"kind":"dev","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"params":{"params":"The parameters required to bridge"}},"canClaim(bytes32,address)":{"params":{"relayer":"The address of the relayer attempting to claim","transactionId":"The transaction id associated with the encoded bridge transaction to check"}},"claim(bytes,address)":{"params":{"request":"The encoded bridge transaction to claim on origin chain","to":"The recipient address of the funds"}},"dispute(bytes32)":{"params":{"transactionId":"The transaction id associated with the encoded bridge transaction to dispute"}},"getBridgeTransaction(bytes)":{"params":{"request":"The bridge request to decode"}},"prove(bytes,bytes32)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","request":"The encoded bridge transaction to prove on origin chain"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"request":"The encoded bridge transaction to relay on destination chain"}}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"BridgeProofDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"transactionHash\",\"type\":\"bytes32\"}],\"name\":\"BridgeProofProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"}],\"name\":\"BridgeRequested\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"canClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransaction\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeTransaction\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"params\":{\"params\":\"The parameters required to bridge\"}},\"canClaim(bytes32,address)\":{\"params\":{\"relayer\":\"The address of the relayer attempting to claim\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to check\"}},\"claim(bytes,address)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\",\"to\":\"The recipient address of the funds\"}},\"dispute(bytes32)\":{\"params\":{\"transactionId\":\"The transaction id associated with the encoded bridge transaction to dispute\"}},\"getBridgeTransaction(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"prove(bytes,bytes32)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"request\":\"The encoded bridge transaction to prove on origin chain\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to relay on destination chain\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer\"},\"canClaim(bytes32,address)\":{\"notice\":\"Checks if the dispute period has passed so bridge deposit can be claimed\"},\"claim(bytes,address)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital\"},\"dispute(bytes32)\":{\"notice\":\"Disputes an outstanding proof in case relayer provided dest chain tx is invalid\"},\"getBridgeTransaction(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction\"},\"prove(bytes,bytes32)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"refund(bytes)\":{\"notice\":\"Refunds an outstanding bridge transaction in case optimistic bridging failed\"},\"relay(bytes)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridge\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","canClaim(bytes32,address)":"aa9641ab","claim(bytes,address)":"41fcb612","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","prove(bytes,bytes32)":"886d36ff","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17"}},"solidity/FastBridgeV2.sol:IFastBridgeRecipient":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"name":"fastBridgeTransferReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"payable","type":"function"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"name\":\"fastBridgeTransferReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridgeRecipient\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"fastBridgeTransferReceived(address,uint256,bytes)":"461e0c21"}},"solidity/FastBridgeV2.sol:IFastBridgeV2":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BridgeDepositRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"}],"name":"BridgeProofDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"bytes32","name":"transactionHash","type":"bytes32"}],"name":"BridgeProofProvided","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"quoteId","type":"bytes"}],"name":"BridgeQuoteDetails","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint32","name":"originChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chainGasAmount","type":"uint256"}],"name":"BridgeRelayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes","name":"request","type":"bytes"},{"indexed":false,"internalType":"uint32","name":"destChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"originToken","type":"address"},{"indexed":false,"internalType":"address","name":"destToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"destAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sendChainGas","type":"bool"}],"name":"BridgeRequested","type":"event"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstChainId","type":"uint32"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IFastBridge.BridgeParams","name":"params","type":"tuple"},{"components":[{"internalType":"address","name":"quoteRelayer","type":"address"},{"internalType":"int256","name":"quoteExclusivitySeconds","type":"int256"},{"internalType":"bytes","name":"quoteId","type":"bytes"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeParamsV2","name":"paramsV2","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeProofs","outputs":[{"internalType":"uint96","name":"timestamp","type":"uint96"},{"internalType":"address","name":"relayer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeRelays","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"bridgeStatuses","outputs":[{"internalType":"enum IFastBridgeV2.BridgeStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"canClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"to","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"}],"name":"dispute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransaction","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"bool","name":"sendChainGas","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IFastBridge.BridgeTransaction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"getBridgeTransactionV2","outputs":[{"components":[{"internalType":"uint32","name":"originChainId","type":"uint32"},{"internalType":"uint32","name":"destChainId","type":"uint32"},{"internalType":"address","name":"originSender","type":"address"},{"internalType":"address","name":"destRecipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"uint256","name":"originAmount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"uint256","name":"originFeeAmount","type":"uint256"},{"internalType":"uint256","name":"callValue","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"exclusivityRelayer","type":"address"},{"internalType":"uint256","name":"exclusivityEndTime","type":"uint256"},{"internalType":"bytes","name":"callParams","type":"bytes"}],"internalType":"struct IFastBridgeV2.BridgeTransactionV2","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"transactionId","type":"bytes32"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"},{"internalType":"address","name":"relayer","type":"address"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"bytes32","name":"destTxHash","type":"bytes32"}],"name":"prove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"request","type":"bytes"},{"internalType":"address","name":"relayer","type":"address"}],"name":"relay","outputs":[],"stateMutability":"payable","type":"function"}],"userDoc":{"kind":"user","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer"},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"notice":"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer."},"bridgeProofs(bytes32)":{"notice":"Returns the timestamp and relayer of a bridge proof"},"bridgeRelays(bytes32)":{"notice":"Checks if a transaction has been relayed"},"bridgeStatuses(bytes32)":{"notice":"Returns the status of a bridge transaction"},"canClaim(bytes32,address)":{"notice":"Checks if the dispute period has passed so bridge deposit can be claimed"},"claim(bytes)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof."},"claim(bytes,address)":{"notice":"Completes bridge transaction on origin chain by claiming originally deposited capital"},"dispute(bytes32)":{"notice":"Disputes an outstanding proof in case relayer provided dest chain tx is invalid"},"getBridgeTransaction(bytes)":{"notice":"Decodes bridge request into a bridge transaction"},"getBridgeTransactionV2(bytes)":{"notice":"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2"},"prove(bytes,bytes32)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"prove(bytes32,bytes32,address)":{"notice":"Provides proof on origin side that relayer provided funds on destination side of bridge transaction"},"refund(bytes)":{"notice":"Refunds an outstanding bridge transaction in case optimistic bridging failed"},"relay(bytes)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"},"relay(bytes,address)":{"notice":"Relays destination side of bridge transaction by off-chain relayer"}},"version":1},"developerDoc":{"kind":"dev","methods":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":{"params":{"params":"The parameters required to bridge"}},"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":{"params":{"params":"The parameters required to bridge","paramsV2":"The parameters for exclusivity fill rights (optional, can be left empty)"}},"bridgeProofs(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"relayer":"The relayer address of the bridge proof","timestamp":"The timestamp of the bridge proof"}},"bridgeRelays(bytes32)":{"params":{"transactionId":"The ID of the transaction to check"},"returns":{"_0":"True if the transaction has been relayed, false otherwise"}},"bridgeStatuses(bytes32)":{"params":{"transactionId":"The ID of the bridge transaction"},"returns":{"_0":"BridgeStatus Status of the bridge transaction"}},"canClaim(bytes32,address)":{"params":{"relayer":"The address of the relayer attempting to claim","transactionId":"The transaction id associated with the encoded bridge transaction to check"}},"claim(bytes)":{"params":{"request":"The encoded bridge transaction to claim on origin chain"}},"claim(bytes,address)":{"params":{"request":"The encoded bridge transaction to claim on origin chain","to":"The recipient address of the funds"}},"dispute(bytes32)":{"params":{"transactionId":"The transaction id associated with the encoded bridge transaction to dispute"}},"getBridgeTransaction(bytes)":{"params":{"request":"The bridge request to decode"}},"getBridgeTransactionV2(bytes)":{"params":{"request":"The bridge request to decode"}},"prove(bytes,bytes32)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","request":"The encoded bridge transaction to prove on origin chain"}},"prove(bytes32,bytes32,address)":{"params":{"destTxHash":"The destination tx hash proving bridge transaction was relayed","relayer":"The address of the relaying entity which should have control of the origin funds when claimed","transactionId":"The transaction id associated with the encoded bridge transaction to prove"}},"refund(bytes)":{"params":{"request":"The encoded bridge transaction to refund"}},"relay(bytes)":{"params":{"request":"The encoded bridge transaction to relay on destination chain"}},"relay(bytes,address)":{"params":{"relayer":"The address of the relaying entity which should have control of the origin funds when claimed","request":"The encoded bridge transaction to relay on destination chain"}}},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeDepositRefunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"BridgeProofDisputed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"transactionHash\",\"type\":\"bytes32\"}],\"name\":\"BridgeProofProvided\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"}],\"name\":\"BridgeQuoteDetails\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainGasAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeRelayed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"}],\"name\":\"BridgeRequested\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"dstChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeParams\",\"name\":\"params\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"quoteRelayer\",\"type\":\"address\"},{\"internalType\":\"int256\",\"name\":\"quoteExclusivitySeconds\",\"type\":\"int256\"},{\"internalType\":\"bytes\",\"name\":\"quoteId\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeParamsV2\",\"name\":\"paramsV2\",\"type\":\"tuple\"}],\"name\":\"bridge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeProofs\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"timestamp\",\"type\":\"uint96\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeRelays\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"bridgeStatuses\",\"outputs\":[{\"internalType\":\"enum IFastBridgeV2.BridgeStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"canClaim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"}],\"name\":\"dispute\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransaction\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sendChainGas\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"}],\"internalType\":\"struct IFastBridge.BridgeTransaction\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"getBridgeTransactionV2\",\"outputs\":[{\"components\":[{\"internalType\":\"uint32\",\"name\":\"originChainId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"destChainId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"originSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destRecipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"originToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"originAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"originFeeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callValue\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"exclusivityRelayer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"exclusivityEndTime\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"callParams\",\"type\":\"bytes\"}],\"internalType\":\"struct IFastBridgeV2.BridgeTransactionV2\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"transactionId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"destTxHash\",\"type\":\"bytes32\"}],\"name\":\"prove\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"request\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"relayer\",\"type\":\"address\"}],\"name\":\"relay\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"params\":{\"params\":\"The parameters required to bridge\"}},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"params\":{\"params\":\"The parameters required to bridge\",\"paramsV2\":\"The parameters for exclusivity fill rights (optional, can be left empty)\"}},\"bridgeProofs(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"relayer\":\"The relayer address of the bridge proof\",\"timestamp\":\"The timestamp of the bridge proof\"}},\"bridgeRelays(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the transaction to check\"},\"returns\":{\"_0\":\"True if the transaction has been relayed, false otherwise\"}},\"bridgeStatuses(bytes32)\":{\"params\":{\"transactionId\":\"The ID of the bridge transaction\"},\"returns\":{\"_0\":\"BridgeStatus Status of the bridge transaction\"}},\"canClaim(bytes32,address)\":{\"params\":{\"relayer\":\"The address of the relayer attempting to claim\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to check\"}},\"claim(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\"}},\"claim(bytes,address)\":{\"params\":{\"request\":\"The encoded bridge transaction to claim on origin chain\",\"to\":\"The recipient address of the funds\"}},\"dispute(bytes32)\":{\"params\":{\"transactionId\":\"The transaction id associated with the encoded bridge transaction to dispute\"}},\"getBridgeTransaction(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"getBridgeTransactionV2(bytes)\":{\"params\":{\"request\":\"The bridge request to decode\"}},\"prove(bytes,bytes32)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"request\":\"The encoded bridge transaction to prove on origin chain\"}},\"prove(bytes32,bytes32,address)\":{\"params\":{\"destTxHash\":\"The destination tx hash proving bridge transaction was relayed\",\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"transactionId\":\"The transaction id associated with the encoded bridge transaction to prove\"}},\"refund(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to refund\"}},\"relay(bytes)\":{\"params\":{\"request\":\"The encoded bridge transaction to relay on destination chain\"}},\"relay(bytes,address)\":{\"params\":{\"relayer\":\"The address of the relaying entity which should have control of the origin funds when claimed\",\"request\":\"The encoded bridge transaction to relay on destination chain\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer\"},\"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))\":{\"notice\":\"Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability to provide temporary exclusivity fill rights for the quote relayer.\"},\"bridgeProofs(bytes32)\":{\"notice\":\"Returns the timestamp and relayer of a bridge proof\"},\"bridgeRelays(bytes32)\":{\"notice\":\"Checks if a transaction has been relayed\"},\"bridgeStatuses(bytes32)\":{\"notice\":\"Returns the status of a bridge transaction\"},\"canClaim(bytes32,address)\":{\"notice\":\"Checks if the dispute period has passed so bridge deposit can be claimed\"},\"claim(bytes)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital.Can only send funds to the relayer address on the proof.\"},\"claim(bytes,address)\":{\"notice\":\"Completes bridge transaction on origin chain by claiming originally deposited capital\"},\"dispute(bytes32)\":{\"notice\":\"Disputes an outstanding proof in case relayer provided dest chain tx is invalid\"},\"getBridgeTransaction(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction\"},\"getBridgeTransactionV2(bytes)\":{\"notice\":\"Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\"},\"prove(bytes,bytes32)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"prove(bytes32,bytes32,address)\":{\"notice\":\"Provides proof on origin side that relayer provided funds on destination side of bridge transaction\"},\"refund(bytes)\":{\"notice\":\"Refunds an outstanding bridge transaction in case optimistic bridging failed\"},\"relay(bytes)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"},\"relay(bytes,address)\":{\"notice\":\"Relays destination side of bridge transaction by off-chain relayer\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridgeV2\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{"bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256))":"45851694","bridge((uint32,address,address,address,address,uint256,uint256,bool,uint256),(address,int256,bytes,uint256,bytes))":"bfc7c607","bridgeProofs(bytes32)":"91ad5039","bridgeRelays(bytes32)":"8379a24f","bridgeStatuses(bytes32)":"051287bc","canClaim(bytes32,address)":"aa9641ab","claim(bytes)":"c63ff8dd","claim(bytes,address)":"41fcb612","dispute(bytes32)":"add98c70","getBridgeTransaction(bytes)":"ac11fb1a","getBridgeTransactionV2(bytes)":"5aa6ccba","prove(bytes,bytes32)":"886d36ff","prove(bytes32,bytes32,address)":"18e4357d","refund(bytes)":"5eb7d946","relay(bytes)":"8f0d6f17","relay(bytes,address)":"9c9545f0"}},"solidity/FastBridgeV2.sol:IFastBridgeV2Errors":{"code":"0x","runtime-code":"0x","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"","srcMapRuntime":"","abiDefinition":[{"inputs":[],"name":"AmountIncorrect","type":"error"},{"inputs":[],"name":"CallParamsLengthAboveMax","type":"error"},{"inputs":[],"name":"ChainIncorrect","type":"error"},{"inputs":[],"name":"DeadlineExceeded","type":"error"},{"inputs":[],"name":"DeadlineNotExceeded","type":"error"},{"inputs":[],"name":"DeadlineTooShort","type":"error"},{"inputs":[],"name":"DisputePeriodNotPassed","type":"error"},{"inputs":[],"name":"DisputePeriodPassed","type":"error"},{"inputs":[],"name":"ExclusivityParamsIncorrect","type":"error"},{"inputs":[],"name":"ExclusivityPeriodNotPassed","type":"error"},{"inputs":[],"name":"MsgValueIncorrect","type":"error"},{"inputs":[],"name":"NativeTokenCallValueNotSupported","type":"error"},{"inputs":[],"name":"RecipientIncorrectReturnValue","type":"error"},{"inputs":[],"name":"RecipientNoReturnValue","type":"error"},{"inputs":[],"name":"SenderIncorrect","type":"error"},{"inputs":[],"name":"StatusIncorrect","type":"error"},{"inputs":[],"name":"TransactionRelayed","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AmountIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CallParamsLengthAboveMax\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ChainIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineNotExceeded\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DeadlineTooShort\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisputePeriodPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityParamsIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ExclusivityPeriodNotPassed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"MsgValueIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NativeTokenCallValueNotSupported\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientIncorrectReturnValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RecipientNoReturnValue\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StatusIncorrect\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransactionRelayed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"IFastBridgeV2Errors\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:SafeERC20":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220bf9b4d830342bc19a7972f35e2bc28e74742724839e41d049e96167e6d81d6ea64736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220bf9b4d830342bc19a7972f35e2bc28e74742724839e41d049e96167e6d81d6ea64736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"45745:5018:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;45745:5018:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"45745:5018:0:-:0;;;;;;;;","abiDefinition":[{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"currentAllowance","type":"uint256"},{"internalType":"uint256","name":"requestedDecrease","type":"uint256"}],"name":"SafeERC20FailedDecreaseAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"}],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"details":"Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.","errors":{"SafeERC20FailedDecreaseAllowance(address,uint256,uint256)":[{"details":"Indicates a failed `decreaseAllowance` request."}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC20 token failed."}]},"kind":"dev","methods":{},"title":"SafeERC20","version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"currentAllowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestedDecrease\",\"type\":\"uint256\"}],\"name\":\"SafeERC20FailedDecreaseAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"}],\"devdoc\":{\"details\":\"Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\",\"errors\":{\"SafeERC20FailedDecreaseAllowance(address,uint256,uint256)\":[{\"details\":\"Indicates a failed `decreaseAllowance` request.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeERC20\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{}},"solidity/FastBridgeV2.sol:UniversalTokenLib":{"code":"0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122030abe7c99e33645ff08fba6fd46ebf752f2157cc4f5e930a35e81633f8aacbb864736f6c63430008180033","runtime-code":"0x73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122030abe7c99e33645ff08fba6fd46ebf752f2157cc4f5e930a35e81633f8aacbb864736f6c63430008180033","info":{"source":"// SPDX-License-Identifier: MIT\npragma solidity =0.8.24 ^0.8.0 ^0.8.20;\n\n// contracts/interfaces/IAdmin.sol\n\ninterface IAdmin {\n // ============ Events ============\n\n event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate);\n event FeesSwept(address token, address recipient, uint256 amount);\n\n event ChainGasAmountUpdated(uint256 oldChainGasAmount, uint256 newChainGasAmount);\n\n // ============ Methods ============\n\n function setProtocolFeeRate(uint256 newFeeRate) external;\n\n function sweepProtocolFees(address token, address recipient) external;\n\n function setChainGasAmount(uint256 newChainGasAmount) external;\n}\n\n// contracts/interfaces/IFastBridge.sol\n\ninterface IFastBridge {\n struct BridgeTransaction {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n bool sendChainGas;\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n }\n\n struct BridgeProof {\n uint96 timestamp;\n address relayer;\n }\n\n // ============ Events ============\n\n event BridgeRequested(\n bytes32 indexed transactionId,\n address indexed sender,\n bytes request,\n uint32 destChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n bool sendChainGas\n );\n event BridgeRelayed(\n bytes32 indexed transactionId,\n address indexed relayer,\n address indexed to,\n uint32 originChainId,\n address originToken,\n address destToken,\n uint256 originAmount,\n uint256 destAmount,\n uint256 chainGasAmount\n );\n event BridgeProofProvided(bytes32 indexed transactionId, address indexed relayer, bytes32 transactionHash);\n event BridgeProofDisputed(bytes32 indexed transactionId, address indexed relayer);\n event BridgeDepositClaimed(\n bytes32 indexed transactionId, address indexed relayer, address indexed to, address token, uint256 amount\n );\n event BridgeDepositRefunded(bytes32 indexed transactionId, address indexed to, address token, uint256 amount);\n\n // ============ Methods ============\n\n struct BridgeParams {\n uint32 dstChainId;\n address sender;\n address to;\n address originToken;\n address destToken;\n uint256 originAmount; // should include protocol fee (if any)\n uint256 destAmount; // should include relayer fee\n bool sendChainGas;\n uint256 deadline;\n }\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer\n /// @param params The parameters required to bridge\n function bridge(BridgeParams memory params) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n function relay(bytes memory request) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param request The encoded bridge transaction to prove on origin chain\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n function prove(bytes memory request, bytes32 destTxHash) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital\n /// @param request The encoded bridge transaction to claim on origin chain\n /// @param to The recipient address of the funds\n function claim(bytes memory request, address to) external;\n\n /// @notice Disputes an outstanding proof in case relayer provided dest chain tx is invalid\n /// @param transactionId The transaction id associated with the encoded bridge transaction to dispute\n function dispute(bytes32 transactionId) external;\n\n /// @notice Refunds an outstanding bridge transaction in case optimistic bridging failed\n /// @param request The encoded bridge transaction to refund\n function refund(bytes memory request) external;\n\n // ============ Views ============\n\n /// @notice Decodes bridge request into a bridge transaction\n /// @param request The bridge request to decode\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory);\n\n /// @notice Checks if the dispute period has passed so bridge deposit can be claimed\n /// @param transactionId The transaction id associated with the encoded bridge transaction to check\n /// @param relayer The address of the relayer attempting to claim\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool);\n}\n\n// contracts/interfaces/IFastBridgeRecipient.sol\n\ninterface IFastBridgeRecipient {\n function fastBridgeTransferReceived(\n address token,\n uint256 amount,\n bytes memory callParams\n )\n external\n payable\n returns (bytes4);\n}\n\n// contracts/interfaces/IFastBridgeV2Errors.sol\n\ninterface IFastBridgeV2Errors {\n error AmountIncorrect();\n error CallParamsLengthAboveMax();\n error ChainIncorrect();\n error ExclusivityParamsIncorrect();\n error MsgValueIncorrect();\n error NativeTokenCallValueNotSupported();\n error SenderIncorrect();\n error StatusIncorrect();\n error ZeroAddress();\n\n error RecipientIncorrectReturnValue();\n error RecipientNoReturnValue();\n\n error DeadlineExceeded();\n error DeadlineNotExceeded();\n error DeadlineTooShort();\n error DisputePeriodNotPassed();\n error DisputePeriodPassed();\n error ExclusivityPeriodNotPassed();\n\n error TransactionRelayed();\n}\n\n// contracts/libs/Errors.sol\n\nerror DeadlineExceeded();\nerror DeadlineNotExceeded();\nerror DeadlineTooShort();\nerror InsufficientOutputAmount();\n\nerror MsgValueIncorrect();\nerror PoolNotFound();\nerror TokenAddressMismatch();\nerror TokenNotContract();\nerror TokenNotETH();\nerror TokensIdentical();\n\nerror ChainIncorrect();\nerror AmountIncorrect();\nerror ZeroAddress();\n\nerror DisputePeriodNotPassed();\nerror DisputePeriodPassed();\nerror SenderIncorrect();\nerror StatusIncorrect();\nerror TransactionIdIncorrect();\nerror TransactionRelayed();\n\n// node_modules/@openzeppelin/contracts/access/IAccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 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 signaling 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, an admin role\n * bearer except when using {AccessControl-_setupRole}.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\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\n// node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 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 apply 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\n// node_modules/@openzeppelin/contracts/utils/Address.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance \u003c amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance \u003c value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 \u0026\u0026 target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length \u003e 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert FailedInnerCall();\n }\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/Context.sol\n\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\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[EIP 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\n// node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position is the index of the value in the `values` array plus 1.\n // Position 0 is used to mean a value is not in the set.\n mapping(bytes32 value =\u003e uint256) _positions;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._positions[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We cache the value's position to prevent multiple reads from the same storage slot\n uint256 position = set._positions[value];\n\n if (position != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 valueIndex = position - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (valueIndex != lastIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the lastValue to the index where the value to delete is\n set._values[valueIndex] = lastValue;\n // Update the tracked position of the lastValue (that was just moved)\n set._positions[lastValue] = position;\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the tracked position for the deleted slot\n delete set._positions[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._positions[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n\n// contracts/interfaces/IFastBridgeV2.sol\n\ninterface IFastBridgeV2 is IFastBridge {\n enum BridgeStatus {\n NULL, // doesn't exist yet\n REQUESTED,\n RELAYER_PROVED,\n RELAYER_CLAIMED,\n REFUNDED\n }\n\n struct BridgeTxDetails {\n BridgeStatus status;\n uint40 proofBlockTimestamp;\n uint48 proofBlockNumber;\n address proofRelayer;\n }\n\n struct BridgeRelay {\n uint48 blockNumber;\n uint48 blockTimestamp;\n address relayer;\n }\n\n /// @notice New params introduced in the FastBridgeV2.\n /// We are passing fields from the older BridgeParams struct outside of this struct\n /// for backwards compatibility.\n /// Note: quoteRelayer and quoteExclusivitySeconds are either both zero (indicating no exclusivity)\n /// or both non-zero (indicating exclusivity for the given period).\n /// Note: callValue \u003e 0 can NOT be used with destToken = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (ETH_ADDRESS)\n /// @param quoteRelayer Relayer that provided the quote for the transaction\n /// @param quoteExclusivitySeconds Period of time the quote relayer is guaranteed exclusivity after user's deposit\n /// @param quoteId Unique quote identifier used for tracking the quote\n /// @param callValue ETH value to send to the recipient (if any)\n /// @param callParams Parameters for the arbitrary call to the destination recipient (if any)\n struct BridgeParamsV2 {\n address quoteRelayer;\n int256 quoteExclusivitySeconds;\n bytes quoteId;\n uint256 callValue;\n bytes callParams;\n }\n\n /// @notice Updated bridge transaction struct to include parameters introduced in FastBridgeV2.\n /// Note: only `exclusivityRelayer` can fill such a transaction until `exclusivityEndTime`.\n /// TODO: consider changing the encoding scheme to prevent spending extra gas on decoding.\n struct BridgeTransactionV2 {\n uint32 originChainId;\n uint32 destChainId;\n address originSender; // user (origin)\n address destRecipient; // user (dest)\n address originToken;\n address destToken;\n uint256 originAmount; // amount in on origin bridge less originFeeAmount\n uint256 destAmount;\n uint256 originFeeAmount;\n uint256 callValue; // ETH value to send to the recipient (if any) - replaces V1's sendChainGas flag\n uint256 deadline; // user specified deadline for destination relay\n uint256 nonce;\n address exclusivityRelayer;\n uint256 exclusivityEndTime;\n bytes callParams;\n }\n\n event BridgeQuoteDetails(bytes32 indexed transactionId, bytes quoteId);\n\n /// @notice Initiates bridge on origin chain to be relayed by off-chain relayer, with the ability\n /// to provide temporary exclusivity fill rights for the quote relayer.\n /// @param params The parameters required to bridge\n /// @param paramsV2 The parameters for exclusivity fill rights (optional, can be left empty)\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) external payable;\n\n /// @notice Relays destination side of bridge transaction by off-chain relayer\n /// @param request The encoded bridge transaction to relay on destination chain\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function relay(bytes memory request, address relayer) external payable;\n\n /// @notice Provides proof on origin side that relayer provided funds on destination side of bridge transaction\n /// @param transactionId The transaction id associated with the encoded bridge transaction to prove\n /// @param destTxHash The destination tx hash proving bridge transaction was relayed\n /// @param relayer The address of the relaying entity which should have control of the origin funds when claimed\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) external;\n\n /// @notice Completes bridge transaction on origin chain by claiming originally deposited capital.\n /// @notice Can only send funds to the relayer address on the proof.\n /// @param request The encoded bridge transaction to claim on origin chain\n function claim(bytes memory request) external;\n /// @notice Checks if a transaction has been relayed\n /// @param transactionId The ID of the transaction to check\n /// @return True if the transaction has been relayed, false otherwise\n function bridgeRelays(bytes32 transactionId) external view returns (bool);\n\n /// @notice Returns the status of a bridge transaction\n /// @param transactionId The ID of the bridge transaction\n /// @return BridgeStatus Status of the bridge transaction\n function bridgeStatuses(bytes32 transactionId) external view returns (BridgeStatus);\n\n /// @notice Returns the timestamp and relayer of a bridge proof\n /// @param transactionId The ID of the bridge transaction\n /// @return timestamp The timestamp of the bridge proof\n /// @return relayer The relayer address of the bridge proof\n function bridgeProofs(bytes32 transactionId) external view returns (uint96 timestamp, address relayer);\n\n /// @notice Decodes bridge request into a bridge transaction V2 struct used by FastBridgeV2\n /// @param request The bridge request to decode\n function getBridgeTransactionV2(bytes memory request) external view returns (BridgeTransactionV2 memory);\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n\n// node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n\n// node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 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 using Address for address;\n\n /**\n * @dev An operation with an ERC20 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 _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\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 _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\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 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 function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance \u003c 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 function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 \u0026\u0026 !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success \u0026\u0026 (returndata.length == 0 || abi.decode(returndata, (bool))) \u0026\u0026 address(token).code.length \u003e 0;\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/AccessControl.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address account =\u003e bool) hasRole;\n bytes32 adminRole;\n }\n\n mapping(bytes32 role =\u003e RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with an {AccessControlUnauthorizedAccount} error including the required role.\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n return _roles[role].hasRole[account];\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n * is missing `role`.\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert AccessControlUnauthorizedAccount(account, role);\n }\n }\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 {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n return _roles[role].adminRole;\n }\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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `callerConfirmation`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n if (callerConfirmation != _msgSender()) {\n revert AccessControlBadConfirmation();\n }\n\n _revokeRole(role, callerConfirmation);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n if (!hasRole(role, account)) {\n _roles[role].hasRole[account] = true;\n emit RoleGranted(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n if (hasRole(role, account)) {\n _roles[role].hasRole[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n return true;\n } else {\n return false;\n }\n }\n}\n\n// contracts/libs/UniversalToken.sol\n\nlibrary UniversalTokenLib {\n using SafeERC20 for IERC20;\n\n address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n /// @notice Transfers tokens to the given account. Reverts if transfer is not successful.\n /// @dev This might trigger fallback, if ETH is transferred to the contract.\n /// Make sure this can not lead to reentrancy attacks.\n function universalTransfer(address token, address to, uint256 value) internal {\n // Don't do anything, if need to send tokens to this address\n if (to == address(this)) return;\n // Don't do anything, if trying to send zero value\n if (value == 0) return;\n if (token == ETH_ADDRESS) {\n /// @dev Note: this can potentially lead to executing code in `to`.\n // solhint-disable-next-line avoid-low-level-calls\n (bool success,) = to.call{value: value}(\"\");\n require(success, \"ETH transfer failed\");\n } else {\n IERC20(token).safeTransfer(to, value);\n }\n }\n\n /// @notice Issues an infinite allowance to the spender, if the current allowance is insufficient\n /// to spend the given amount.\n function universalApproveInfinity(address token, address spender, uint256 amountToSpend) internal {\n // ETH Chad doesn't require your approval\n if (token == ETH_ADDRESS) return;\n // No-op if allowance is already sufficient\n uint256 allowance = IERC20(token).allowance(address(this), spender);\n if (allowance \u003e= amountToSpend) return;\n // Otherwise, reset approval to 0 and set to max allowance\n if (allowance \u003e 0) IERC20(token).safeDecreaseAllowance(spender, allowance);\n IERC20(token).safeIncreaseAllowance(spender, type(uint256).max);\n }\n\n /// @notice Returns the balance of the given token (or native ETH) for the given account.\n function universalBalanceOf(address token, address account) internal view returns (uint256) {\n if (token == ETH_ADDRESS) {\n return account.balance;\n } else {\n return IERC20(token).balanceOf(account);\n }\n }\n\n /// @dev Checks that token is a contract and not ETH_ADDRESS.\n function assertIsContract(address token) internal view {\n // Check that ETH_ADDRESS was not used (in case this is a predeploy on any of the chains)\n if (token == UniversalTokenLib.ETH_ADDRESS) revert TokenNotContract();\n // Check that token is not an EOA\n if (token.code.length == 0) revert TokenNotContract();\n }\n}\n\n// node_modules/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol\n\n// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 role =\u003e EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {AccessControl-_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool granted = super._grantRole(role, account);\n if (granted) {\n _roleMembers[role].add(account);\n }\n return granted;\n }\n\n /**\n * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {\n bool revoked = super._revokeRole(role, account);\n if (revoked) {\n _roleMembers[role].remove(account);\n }\n return revoked;\n }\n}\n\n// contracts/Admin.sol\n\ncontract Admin is IAdmin, AccessControlEnumerable {\n using UniversalTokenLib for address;\n\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n bytes32 public constant REFUNDER_ROLE = keccak256(\"REFUNDER_ROLE\");\n bytes32 public constant GUARD_ROLE = keccak256(\"GUARD_ROLE\");\n bytes32 public constant GOVERNOR_ROLE = keccak256(\"GOVERNOR_ROLE\");\n\n uint256 public constant FEE_BPS = 1e6;\n uint256 public constant FEE_RATE_MAX = 0.01e6; // max 1% on origin amount\n\n /// @notice Protocol fee rate taken on origin amount deposited in origin chain\n uint256 public protocolFeeRate;\n\n /// @notice Protocol fee amounts accumulated\n mapping(address =\u003e uint256) public protocolFees;\n\n /// @notice Chain gas amount to forward as rebate if requested\n uint256 public chainGasAmount;\n\n constructor(address _owner) {\n _grantRole(DEFAULT_ADMIN_ROLE, _owner);\n }\n\n function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) {\n require(newFeeRate \u003c= FEE_RATE_MAX, \"newFeeRate \u003e max\");\n uint256 oldFeeRate = protocolFeeRate;\n protocolFeeRate = newFeeRate;\n emit FeeRateUpdated(oldFeeRate, newFeeRate);\n }\n\n function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) {\n uint256 feeAmount = protocolFees[token];\n if (feeAmount == 0) return; // skip if no accumulated fees\n\n protocolFees[token] = 0;\n token.universalTransfer(recipient, feeAmount);\n emit FeesSwept(token, recipient, feeAmount);\n }\n\n function setChainGasAmount(uint256 newChainGasAmount) external onlyRole(GOVERNOR_ROLE) {\n uint256 oldChainGasAmount = chainGasAmount;\n chainGasAmount = newChainGasAmount;\n emit ChainGasAmountUpdated(oldChainGasAmount, newChainGasAmount);\n }\n}\n\n// contracts/FastBridgeV2.sol\n\n/// @notice FastBridgeV2 is a contract for bridging tokens across chains.\ncontract FastBridgeV2 is Admin, IFastBridgeV2, IFastBridgeV2Errors {\n using SafeERC20 for IERC20;\n using UniversalTokenLib for address;\n\n /// @notice Dispute period for relayed transactions\n uint256 public constant DISPUTE_PERIOD = 30 minutes;\n\n /// @notice Delay for a transaction after which it could be permisionlessly refunded\n uint256 public constant REFUND_DELAY = 7 days;\n\n /// @notice Minimum deadline period to relay a requested bridge transaction\n uint256 public constant MIN_DEADLINE_PERIOD = 30 minutes;\n\n /// @notice Maximum length of accepted callParams\n uint256 public constant MAX_CALL_PARAMS_LENGTH = 2 ** 16 - 1;\n\n /// @notice Status of the bridge tx on origin chain\n mapping(bytes32 =\u003e BridgeTxDetails) public bridgeTxDetails;\n /// @notice Relay details on destination chain\n mapping(bytes32 =\u003e BridgeRelay) public bridgeRelayDetails;\n /// @notice Unique bridge nonces tracked per originSender\n mapping(address =\u003e uint256) public senderNonces;\n\n /// @notice This is deprecated and should not be used.\n /// @dev Replaced by senderNonces\n uint256 public immutable nonce = 0;\n /// @notice the block the contract was deployed at\n uint256 public immutable deployBlock;\n\n constructor(address _owner) Admin(_owner) {\n deployBlock = block.number;\n }\n\n /// @inheritdoc IFastBridge\n function bridge(BridgeParams memory params) external payable {\n bridge({\n params: params,\n paramsV2: BridgeParamsV2({\n quoteRelayer: address(0),\n quoteExclusivitySeconds: 0,\n quoteId: bytes(\"\"),\n callValue: 0,\n callParams: bytes(\"\")\n })\n });\n }\n\n /// @inheritdoc IFastBridge\n function relay(bytes memory request) external payable {\n relay({request: request, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridge\n function prove(bytes memory request, bytes32 destTxHash) external {\n prove({transactionId: keccak256(request), destTxHash: destTxHash, relayer: msg.sender});\n }\n\n /// @inheritdoc IFastBridgeV2\n function claim(bytes memory request) external {\n claim({request: request, to: address(0)});\n }\n\n /// @inheritdoc IFastBridge\n function dispute(bytes32 transactionId) external onlyRole(GUARD_ROLE) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD) {\n revert DisputePeriodPassed();\n }\n\n // @dev relayer gets slashed effectively if dest relay has gone thru\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n bridgeTxDetails[transactionId].proofRelayer = address(0);\n bridgeTxDetails[transactionId].proofBlockTimestamp = 0;\n bridgeTxDetails[transactionId].proofBlockNumber = 0;\n\n emit BridgeProofDisputed(transactionId, msg.sender);\n }\n\n /// @inheritdoc IFastBridge\n function refund(bytes memory request) external {\n bytes32 transactionId = keccak256(request);\n\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n\n if (hasRole(REFUNDER_ROLE, msg.sender)) {\n // Refunder can refund if deadline has passed\n if (block.timestamp \u003c= transaction.deadline) revert DeadlineNotExceeded();\n } else {\n // Permissionless refund is allowed after REFUND_DELAY\n if (block.timestamp \u003c= transaction.deadline + REFUND_DELAY) revert DeadlineNotExceeded();\n }\n\n // if all checks passed, set to REFUNDED status\n bridgeTxDetails[transactionId].status = BridgeStatus.REFUNDED;\n\n // transfer origin collateral back to original sender\n address to = transaction.originSender;\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount + transaction.originFeeAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositRefunded(transactionId, to, token, amount);\n }\n\n /// @inheritdoc IFastBridge\n function canClaim(bytes32 transactionId, address relayer) external view returns (bool) {\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n if (bridgeTxDetails[transactionId].proofRelayer != relayer) revert SenderIncorrect();\n return _timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003e DISPUTE_PERIOD;\n }\n\n /// @inheritdoc IFastBridge\n /// @dev This method is added to achieve backwards compatibility with decoding requests into V1 structs:\n /// - `callValue` is partially reported as a zero/non-zero flag\n /// - `callParams` is ignored\n /// In order to process all kinds of requests use getBridgeTransactionV2 instead.\n function getBridgeTransaction(bytes memory request) external view returns (BridgeTransaction memory) {\n // Try decoding into V2 struct first. This will revert if V1 struct is passed\n try this.getBridgeTransactionV2(request) returns (BridgeTransactionV2 memory txV2) {\n // Note: we entirely ignore the callParams field, as it was not present in V1\n return BridgeTransaction({\n originChainId: txV2.originChainId,\n destChainId: txV2.destChainId,\n originSender: txV2.originSender,\n destRecipient: txV2.destRecipient,\n originToken: txV2.originToken,\n destToken: txV2.destToken,\n originAmount: txV2.originAmount,\n destAmount: txV2.destAmount,\n originFeeAmount: txV2.originFeeAmount,\n sendChainGas: txV2.callValue != 0,\n deadline: txV2.deadline,\n nonce: txV2.nonce\n });\n } catch {\n // Fallback to V1 struct\n return abi.decode(request, (BridgeTransaction));\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridge(BridgeParams memory params, BridgeParamsV2 memory paramsV2) public payable {\n int256 exclusivityEndTime = int256(block.timestamp) + paramsV2.quoteExclusivitySeconds;\n _validateBridgeParams(params, paramsV2, exclusivityEndTime);\n\n // transfer tokens to bridge contract\n /// @dev use returned originAmount in request in case of transfer fees\n uint256 originAmount = _takeBridgedUserAsset(params.originToken, params.originAmount);\n\n // track amount of origin token owed to protocol\n uint256 originFeeAmount;\n if (protocolFeeRate \u003e 0) originFeeAmount = (originAmount * protocolFeeRate) / FEE_BPS;\n originAmount -= originFeeAmount; // remove from amount used in request as not relevant for relayers\n\n // set status to requested\n bytes memory request = abi.encode(\n BridgeTransactionV2({\n originChainId: uint32(block.chainid),\n destChainId: params.dstChainId,\n originSender: params.sender,\n destRecipient: params.to,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n originFeeAmount: originFeeAmount,\n callValue: paramsV2.callValue,\n deadline: params.deadline,\n nonce: senderNonces[params.sender]++, // increment nonce on every bridge\n exclusivityRelayer: paramsV2.quoteRelayer,\n // We checked exclusivityEndTime to be in range (0 .. params.deadline] above, so can safely cast\n exclusivityEndTime: uint256(exclusivityEndTime),\n callParams: paramsV2.callParams\n })\n );\n bytes32 transactionId = keccak256(request);\n bridgeTxDetails[transactionId].status = BridgeStatus.REQUESTED;\n\n emit BridgeRequested({\n transactionId: transactionId,\n sender: params.sender,\n request: request,\n destChainId: params.dstChainId,\n originToken: params.originToken,\n destToken: params.destToken,\n originAmount: originAmount,\n destAmount: params.destAmount,\n sendChainGas: paramsV2.callValue != 0\n });\n emit BridgeQuoteDetails(transactionId, paramsV2.quoteId);\n }\n\n /// @inheritdoc IFastBridgeV2\n function relay(bytes memory request, address relayer) public payable {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n _validateRelayParams(transaction, transactionId, relayer);\n // mark bridge transaction as relayed\n bridgeRelayDetails[transactionId] =\n BridgeRelay({blockNumber: uint48(block.number), blockTimestamp: uint48(block.timestamp), relayer: relayer});\n\n // transfer tokens to recipient on destination chain and do an arbitrary call if requested\n address to = transaction.destRecipient;\n address token = transaction.destToken;\n uint256 amount = transaction.destAmount;\n uint256 callValue = transaction.callValue;\n\n // Emit the event before any external calls\n emit BridgeRelayed({\n transactionId: transactionId,\n relayer: relayer,\n to: to,\n originChainId: transaction.originChainId,\n originToken: transaction.originToken,\n destToken: token,\n originAmount: transaction.originAmount,\n destAmount: amount,\n chainGasAmount: callValue\n });\n\n // All state changes have been done at this point, can proceed to the external calls.\n // This follows the checks-effects-interactions pattern to mitigate potential reentrancy attacks.\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH non-zero callValue is not allowed\n if (callValue != 0) revert NativeTokenCallValueNotSupported();\n // Check that the correct msg.value was sent\n if (msg.value != amount) revert MsgValueIncorrect();\n } else {\n // For ERC20s, we check that the correct msg.value was sent\n if (msg.value != callValue) revert MsgValueIncorrect();\n // We need to transfer the tokens from the Relayer to the recipient first before performing an\n // optional post-transfer arbitrary call.\n IERC20(token).safeTransferFrom(msg.sender, to, amount);\n }\n\n if (transaction.callParams.length != 0) {\n // Arbitrary call requested, perform it while supplying full msg.value to the recipient\n // Note: if token has a fee on transfers, the recipient will have received less than `amount`.\n // This is a very niche edge case and should be handled by the recipient contract.\n _checkedCallRecipient({recipient: to, token: token, amount: amount, callParams: transaction.callParams});\n } else if (msg.value != 0) {\n // No arbitrary call requested, but msg.value was sent. This is either a relay with ETH,\n // or a non-zero callValue request with an ERC20. In both cases, transfer the ETH to the recipient.\n Address.sendValue(payable(to), msg.value);\n }\n }\n\n /// @inheritdoc IFastBridgeV2\n function prove(bytes32 transactionId, bytes32 destTxHash, address relayer) public onlyRole(RELAYER_ROLE) {\n // update bridge tx status given proof provided\n if (bridgeTxDetails[transactionId].status != BridgeStatus.REQUESTED) revert StatusIncorrect();\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_PROVED;\n bridgeTxDetails[transactionId].proofBlockTimestamp = uint40(block.timestamp);\n bridgeTxDetails[transactionId].proofBlockNumber = uint48(block.number);\n bridgeTxDetails[transactionId].proofRelayer = relayer;\n\n emit BridgeProofProvided(transactionId, relayer, destTxHash);\n }\n\n /// @inheritdoc IFastBridge\n function claim(bytes memory request, address to) public {\n bytes32 transactionId = keccak256(request);\n BridgeTransactionV2 memory transaction = getBridgeTransactionV2(request);\n\n // update bridge tx status if able to claim origin collateral\n if (bridgeTxDetails[transactionId].status != BridgeStatus.RELAYER_PROVED) revert StatusIncorrect();\n\n // if \"to\" is zero addr, permissionlessly send funds to proven relayer\n if (to == address(0)) {\n to = bridgeTxDetails[transactionId].proofRelayer;\n } else if (bridgeTxDetails[transactionId].proofRelayer != msg.sender) {\n revert SenderIncorrect();\n }\n\n if (_timeSince(bridgeTxDetails[transactionId].proofBlockTimestamp) \u003c= DISPUTE_PERIOD) {\n revert DisputePeriodNotPassed();\n }\n\n bridgeTxDetails[transactionId].status = BridgeStatus.RELAYER_CLAIMED;\n\n // update protocol fees if origin fee amount exists\n if (transaction.originFeeAmount \u003e 0) protocolFees[transaction.originToken] += transaction.originFeeAmount;\n\n // transfer origin collateral less fee to specified address\n address token = transaction.originToken;\n uint256 amount = transaction.originAmount;\n token.universalTransfer(to, amount);\n\n emit BridgeDepositClaimed(transactionId, bridgeTxDetails[transactionId].proofRelayer, to, token, amount);\n }\n\n function bridgeStatuses(bytes32 transactionId) public view returns (BridgeStatus status) {\n return bridgeTxDetails[transactionId].status;\n }\n\n function bridgeProofs(bytes32 transactionId) public view returns (uint96 timestamp, address relayer) {\n timestamp = bridgeTxDetails[transactionId].proofBlockTimestamp;\n relayer = bridgeTxDetails[transactionId].proofRelayer;\n }\n\n /// @inheritdoc IFastBridgeV2\n function bridgeRelays(bytes32 transactionId) public view returns (bool) {\n // has this transactionId been relayed?\n return bridgeRelayDetails[transactionId].relayer != address(0);\n }\n\n /// @inheritdoc IFastBridgeV2\n function getBridgeTransactionV2(bytes memory request) public pure returns (BridgeTransactionV2 memory) {\n return abi.decode(request, (BridgeTransactionV2));\n }\n\n /// @notice Takes the bridged asset from the user into FastBridgeV2 custody. It will be later\n /// claimed by the relayer who completed the relay on destination chain, or refunded back to the user,\n /// should no one complete the relay.\n function _takeBridgedUserAsset(address token, uint256 amount) internal returns (uint256 amountTaken) {\n if (token == UniversalTokenLib.ETH_ADDRESS) {\n // For ETH we just need to check that the supplied msg.value is correct.\n // Supplied `msg.value` is already in FastBridgeV2 custody.\n if (amount != msg.value) revert MsgValueIncorrect();\n amountTaken = msg.value;\n } else {\n // For ERC20s, token is explicitly transferred from the user to FastBridgeV2.\n // We don't allow non-zero `msg.value` to avoid extra funds from being stuck in FastBridgeV2.\n token.assertIsContract();\n if (msg.value != 0) revert MsgValueIncorrect();\n amountTaken = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n // Use the balance difference as the amount taken in case of fee on transfer tokens.\n amountTaken = IERC20(token).balanceOf(address(this)) - amountTaken;\n }\n }\n\n /// @notice Calls the Recipient's hook function with the specified callParams and performs\n /// all the necessary checks for the returned value.\n function _checkedCallRecipient(\n address recipient,\n address token,\n uint256 amount,\n bytes memory callParams\n )\n internal\n {\n bytes memory hookData =\n abi.encodeCall(IFastBridgeRecipient.fastBridgeTransferReceived, (token, amount, callParams));\n // This will bubble any revert messages from the hook function\n bytes memory returnData = Address.functionCallWithValue({target: recipient, data: hookData, value: msg.value});\n // Explicit revert if no return data at all\n if (returnData.length == 0) revert RecipientNoReturnValue();\n // Check that exactly a single return value was returned\n if (returnData.length != 32) revert RecipientIncorrectReturnValue();\n // Return value should be abi-encoded hook function selector\n if (bytes32(returnData) != bytes32(IFastBridgeRecipient.fastBridgeTransferReceived.selector)) {\n revert RecipientIncorrectReturnValue();\n }\n }\n\n /// @notice Calculates time since proof submitted\n /// @dev proof.timestamp stores casted uint40(block.timestamp) block timestamps for gas optimization\n /// _timeSince(proof) can accomodate rollover case when block.timestamp \u003e type(uint40).max but\n /// proof.timestamp \u003c type(uint40).max via unchecked statement\n /// @param proofBlockTimestamp The bridge proof block timestamp\n /// @return delta Time delta since proof submitted\n function _timeSince(uint40 proofBlockTimestamp) internal view returns (uint256 delta) {\n unchecked {\n delta = uint40(block.timestamp) - proofBlockTimestamp;\n }\n }\n\n /// @notice Performs all the necessary checks for a bridge to happen.\n /// @dev There's no good way to refactor this function to reduce cyclomatic complexity due to\n /// the number of checks that need to be performed, so we skip the code-complexity rule here.\n // solhint-disable-next-line code-complexity\n function _validateBridgeParams(\n BridgeParams memory params,\n BridgeParamsV2 memory paramsV2,\n int256 exclusivityEndTime\n )\n internal\n view\n {\n // Check V1 (legacy) params\n if (params.dstChainId == block.chainid) revert ChainIncorrect();\n if (params.originAmount == 0 || params.destAmount == 0) revert AmountIncorrect();\n if (params.sender == address(0) || params.to == address(0)) revert ZeroAddress();\n if (params.originToken == address(0) || params.destToken == address(0)) revert ZeroAddress();\n if (params.deadline \u003c block.timestamp + MIN_DEADLINE_PERIOD) revert DeadlineTooShort();\n // Check V2 params\n if (paramsV2.callParams.length \u003e MAX_CALL_PARAMS_LENGTH) revert CallParamsLengthAboveMax();\n if (paramsV2.callValue != 0 \u0026\u0026 params.destToken == UniversalTokenLib.ETH_ADDRESS) {\n revert NativeTokenCallValueNotSupported();\n }\n // exclusivityEndTime must be in range (0 .. params.deadline]\n if (exclusivityEndTime \u003c= 0 || exclusivityEndTime \u003e int256(params.deadline)) {\n revert ExclusivityParamsIncorrect();\n }\n }\n\n /// @notice Performs all the necessary checks for a relay to happen.\n function _validateRelayParams(\n BridgeTransactionV2 memory transaction,\n bytes32 transactionId,\n address relayer\n )\n internal\n view\n {\n if (relayer == address(0)) revert ZeroAddress();\n // Check if the transaction has already been relayed\n if (bridgeRelays(transactionId)) revert TransactionRelayed();\n if (transaction.destChainId != block.chainid) revert ChainIncorrect();\n // Check the deadline for relay to happen\n if (block.timestamp \u003e transaction.deadline) revert DeadlineExceeded();\n // Check the exclusivity period, if it is still ongoing\n // forgefmt: disable-next-item\n if (\n transaction.exclusivityRelayer != address(0) \u0026\u0026\n transaction.exclusivityRelayer != relayer \u0026\u0026\n block.timestamp \u003c= transaction.exclusivityEndTime\n ) {\n revert ExclusivityPeriodNotPassed();\n }\n }\n}\n","language":"Solidity","languageVersion":"0.8.24","compilerVersion":"0.8.24","compilerOptions":"--combined-json bin,bin-runtime,srcmap,srcmap-runtime,abi,userdoc,devdoc,metadata,hashes --optimize --optimize-runs 10000 --allow-paths ., ./, ../ --evm-version=istanbul","srcMap":"57704:2551:0:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;57704:2551:0;;;;;;;;;;;;;;;;;","srcMapRuntime":"57704:2551:0:-:0;;;;;;;;","abiDefinition":[],"userDoc":{"kind":"user","methods":{},"version":1},"developerDoc":{"kind":"dev","methods":{},"version":1},"metadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solidity/FastBridgeV2.sol\":\"UniversalTokenLib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"solidity/FastBridgeV2.sol\":{\"keccak256\":\"0xfd916c030b1ffca5a136817827b8018c8ba42ca089905747f3de6148b73eb35e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://18e6438c4096deb8ae453fb3365ba2b07d52944e93c08288fc5d012b71bf6bb3\",\"dweb:/ipfs/QmfEMqpT1zz6RRm7UuHLRowe1tds2cTGLrVonfm9XSCACj\"]}},\"version\":1}"},"hashes":{}}} \ No newline at end of file